public void Play() { int Count; Boolean Eaten; Boolean FlaskFound; char MoveDirection; Boolean ValidMove; CellReference Position; Eaten = false; FlaskFound = false; Cavern.Display(Monster.GetAwake()); do { do { DisplayMoveOptions(); MoveDirection = GetMove(); ValidMove = CheckValidMove(MoveDirection); if (!ValidMove) { Console.WriteLine("That is not a valid move please try again"); } } while (!ValidMove); if (MoveDirection != 'M') { Cavern.PlaceItem(Player.GetPosition(), ' '); Player.MakeMove(MoveDirection); Cavern.PlaceItem(Player.GetPosition(), '*'); Cavern.Display(Monster.GetAwake()); FlaskFound = Player.CheckIfSameCell(Flask.GetPosition()); if (FlaskFound) { DisplayWonGameMessage(); } Eaten = Monster.CheckIfSameCell(Player.GetPosition()); // This selection structure checks to see if the player has // triggered one of the traps in the cavern if (!Monster.GetAwake() && !FlaskFound && !Eaten && ((Player.CheckIfSameCell(Trap1.GetPosition()) && !Trap1.GetTriggered()) || (Player.CheckIfSameCell(Trap2.GetPosition()) && !Trap2.GetTriggered()))) { Monster.ChangeSleepStatus(); DisplayTrapMessage(); Cavern.Display(Monster.GetAwake()); } if (Monster.GetAwake() && !Eaten && !FlaskFound) { Count = 0; do { Cavern.PlaceItem(Monster.GetPosition(), ' '); Position = Monster.GetPosition(); Monster.MakeMove(Player.GetPosition()); Cavern.PlaceItem(Monster.GetPosition(), 'M'); if (Monster.CheckIfSameCell(Flask.GetPosition())) { Flask.SetPosition(Position); Cavern.PlaceItem(Position, 'F'); } Eaten = Monster.CheckIfSameCell(Player.GetPosition()); Console.WriteLine(); Console.WriteLine("Press Enter key to continue"); Console.ReadLine(); Cavern.Display(Monster.GetAwake()); Count = Count + 1; } while (Count != 2 && !Eaten); } if (Eaten) { DisplayLostGameMessage(); } } } while (!Eaten && !FlaskFound && MoveDirection != 'M'); }