Initial commit
This commit is contained in:
commit
593d8ebfea
30 changed files with 2206 additions and 0 deletions
55
BucketChain/Chain.cs
Normal file
55
BucketChain/Chain.cs
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
namespace BucketChain;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a bucket chain which connects a well with a fire by cooperating people with buckets.
|
||||
/// </summary>
|
||||
public sealed class Chain
|
||||
{
|
||||
// TODO
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new bucket chain based on the supplied parameters.
|
||||
/// </summary>
|
||||
/// <param name="requiredPeople">Min. amount of people required to reach the fire</param>
|
||||
/// <param name="availableBuckets">Max. amount of buckets that can be active in the chain</param>
|
||||
/// <param name="bucketSize">Size of the buckets used in the chain - all buckets have the same size</param>
|
||||
/// <param name="well">A reference to the well, used as water source</param>
|
||||
/// <param name="fire">A reference to the fire this chain attempts to extinguish</param>
|
||||
/// <param name="firstPerson">Reference to the first person in the chain</param>
|
||||
public Chain(int requiredPeople, int availableBuckets, double bucketSize,
|
||||
Well well, Fire fire, Person firstPerson)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Operates the bucket chain. This includes multiple things:
|
||||
/// 1) Refill the well
|
||||
/// 2) Allow the fire to grow
|
||||
/// 3) If first person has a bucket, fill it at the well
|
||||
/// 4) Move the buckets along the chain of people
|
||||
/// 5) If the last person reaches the fire and has a full bucket, use it to fight the fire
|
||||
/// People can join the chain at various positions, so the <see cref="Chain"/> always has to
|
||||
/// determine the current first person before operating.
|
||||
/// </summary>
|
||||
/// <param name="currentStep">The current step</param>
|
||||
/// <param name="error">Set to true if an error occurred while operating, e.g. invalid state of the chain</param>
|
||||
/// <returns>True if the fire could be extinguished in this step; false otherwise</returns>
|
||||
public bool Operate(int currentStep, out bool error)
|
||||
{
|
||||
// TODO
|
||||
error = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents this <see cref="Chain"/> with the referenced <see cref="Well"/>, <see cref="Fire"/>
|
||||
/// and <see cref="Person"/> instances as string, ready to print to the terminal.
|
||||
/// </summary>
|
||||
/// <returns>String representation of the bucket chain</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
// TODO
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue