private static void Play(ZhedBoard board) { while (!board.isOver) { board.PrintBoard(); Console.Write("Select tile (X, Y) / H for hint: "); string input = Console.ReadLine(); if (input.ToLower() == "h") { ShowHint(board); continue; } string[] coordsInput = input.Split(); int X, Y; if (coordsInput.Length != 2 || !int.TryParse(coordsInput[0], out X) || !int.TryParse(coordsInput[1], out Y)) { Console.WriteLine("Invalid input"); continue; } Console.Write("Select direction (U D L R): "); char dirInput = Console.ReadKey().KeyChar; Console.WriteLine(); switch(char.ToUpper(dirInput)) { case 'U': board = board.GoUp(new Coords(X, Y)); break; case 'D': board = board.GoDown(new Coords(X, Y)); break; case 'L': board = board.GoLeft(new Coords(X, Y)); break; case 'R': board = board.GoRight(new Coords(X, Y)); break; default: Console.WriteLine("Invalid direction."); break; } } Console.WriteLine("You win!"); board.PrintBoard(); }