public static void Main()
var graph = CreateGraph();
private static void Flow(G glass)
Out($" Flowing into glass {glass.Id}...");
var isWaterEscaping = false;
if (glass.Pipes is object)
foreach (var pipe in glass.Pipes)
Out($" Flowing into pipe {pipe.Id}...");
if (!pipe.IsFull && !pipe.StartBlocked)
if (pipe.EndBlocked || pipe.Glass.IsFull)
Out($"Filled pipe {pipe.Id}");
else if (pipe.StartBlocked)
Out($" Can't fill pipe {pipe.Id} as start blocked...");
Out($"Filled glass {glass.Id}");
private static void Out(string value)
Console.WriteLine(value);
private static G CreateGraph()
public bool StartBlocked;