/// <summary> /// Play Game /// </summary> /// <returns>Boolean Value indicated game was won</returns> public bool Play() { var play = true; bool won = false; while (play) { PrintMenu(); var opt = Console.ReadLine().ToLower(); switch (opt) { case "f3": WaterProblem.FillThreeUnitContainer(); Moves++; break; case "f5": WaterProblem.FillFiveUnitContainer(); Moves++; break; case "p3": WaterProblem.PourToFiveUnitContainer(); Moves++; break; case "p5": WaterProblem.PourToThreeUnitContainer(); Moves++; break; case "e3": WaterProblem.EmptyThreeUnitContainer(); Moves++; break; case "e5": WaterProblem.EmptyFiveUnitContainer(); Moves++; break; case "exit": play = false; break; } PrintStatus(); if (CheckWin()) { play = false; won = true; Console.WriteLine("Congratulations you won!"); Console.WriteLine(); } } return(won); }