private static void ProgramLoop(IChessBoard board) { Console.WriteLine("To move select your chess piece by command 'select x,y' where x is column and y is row."); Console.WriteLine("Next move by command 'move x,y' where x is column and y is row."); Console.WriteLine("Move:"); input = string.Empty; while (!input.Equals("exit")) { input = Console.ReadLine().Trim().ToLower(); if (input.Contains("move")) { if (selected == null) { Console.WriteLine("No chess piece selected."); continue; } if (!board.MovePiece(selected.Position, GetCoordinates(input))) { Console.WriteLine("Invalid move."); } board.ShowBoard(); selected = null; continue; } else if (input.Contains("select")) { try { selected = board.GetSquare(GetCoordinates(input)); if (selected == null) { Console.WriteLine("No chess piece selected."); } } catch (ArgumentException e) { Console.WriteLine(e.Message); } continue; } if (input.Contains("exit")) { break; } Console.WriteLine("Invalid command. Try again."); } }