namespace BucketChain;
///
/// Represents a person working together with others in a bucket chain to extinguish a fire.
///
public sealed class Person
{
// TODO
///
/// Creates a new person.
/// We are not interested in any specific details of the person,
/// only the position in the chain is relevant.
///
public Person()
{
// TODO
}
///
/// Gets if the person currently has at least one bucket (forward or backward).
///
public bool HasBucket => false; // TODO
///
/// Gets the left neighbor of the person. Can be null.
///
// TODO
// public Person? LeftNeighbor ...
///
/// Gets the right neighbor of the person. Can be null.
///
// TODO
// public Person? RightNeighbor ...
///
/// Gets the number of the last step in which this person performed a bucket move action.
/// Each person can only move, at most, once per step.
///
// TODO
// public int LastStepPerformed ...
///
/// The person joins an existing bucket chain at a specific position.
/// This position is defined by the passed person and the information if this person will join
/// the chain on the left or right side of the passed person.
/// If the passed person already had a neighbor at this side this person joins between them.
///
/// The neighbor in the bucket chain
/// If true the passed person will become the left hand side
/// neighbor of this person; otherwise it will become the right hand side neighbor
public void JoinChain(Person neighbor, bool isLeftNeighbor)
{
// TODO
}
///
/// Attempts to move the forward bucket along the chain towards the fire.
/// The person negotiates with the right hand side neighbor.
/// If that neighbor can accept a forward bucket it received it.
/// They also check if the right hand side neighbor has a backward (towards the well)
/// bucket. If this person is able to receive the backward bucket it receives it.
/// If at least one bucket is exchanged both involved people are done for the current step.
///
/// Number of the current (chain) operation step
/// True if the move attempt produced no errors - this does not mean
/// that a bucket was moved, only that no invalid state was detected; false otherwise
public bool MoveBucket(int currentStep)
{
// TODO
return false;
}
///
/// Fights the passed fire with water from the forward bucket. This empties the bucket.
/// After using it the now empty bucket is moved to the backward position.
///
/// The fire to throw water at
public void FightFire(Fire fire)
{
// TODO
}
///
/// Uses the passed well to fill the bucket.
/// If this person currently has no empty bucket to fill but there are still unused buckets
/// available for the chain a new bucket will be introduced with this method.
/// If the person has no forward bucket but a backward bucket that one is filled.
///
/// The well to use for filling the bucket
/// A new bucket to use; can be null
public void UseWell(Well well, Bucket? additionalBucket)
{
// TODO
}
///
/// Creates a string representation of this person instance.
/// Shows if the person has none, an empty or full bucket.
/// If the person has both forward and backward buckets the forward bucket is displayed.
///
/// String representation of the person
public override string ToString()
{
// TODO
return string.Empty;
}
}