static void InteractiveConsole() { ChessBoard chessBoard = new ChessBoard(); //(new TraditionalBoardStager()).Stage(chessBoard); //(new RookTestingBoardStager()).Stage(chessBoard); //(new BishopTestingBoardStager()).Stage(chessBoard); //(new QueenTestingBoardStager()).Stage(chessBoard); //(new EnPassantTestingBoardStager()).Stage(chessBoard); //(new PawnSwapBoardStager()).Stage(chessBoard); (new KnightTestingBoardStager()).Stage(chessBoard); ChessGame chessGame = new ChessGame( chessBoard, PlayerTypeEnum.White, new Dictionary<PlayerTypeEnum, List<ChessPiece>>()); ChessPiece[,] state = chessBoard.CreateStateCopy(); (new ConsoleBoardPrinter()).PrintBoard(state, PlayerTypeEnum.White); PlayerTypeEnum playerTurn = PlayerTypeEnum.White; Console.WriteLine("Input: 1 square [a2] to show possible moves; 2 square [a1b1] to move"); string move; Console.Write("> "); while (!string.IsNullOrWhiteSpace(move = Console.ReadLine())) { try { if (string.IsNullOrWhiteSpace(move)) break; if (move.Length == 2) { var cpyb = new ChessBoard(chessBoard.CreateStateCopy()); var pm = (new PotentialMoveService()).GetPotentialMoves(chessGame, playerTurn); List<string> moves; pm.TryGetValue(move, out moves); moves = moves ?? new List<string>(); (new ConsoleBoardPrinter()).PrintBoard(state, PlayerTypeEnum.White, new HashSet<string>(moves)); } else if (move.Length == 4) { var moveResult = chessGame.PlayerMove(playerTurn, move); playerTurn = moveResult.Turn; state = chessBoard.CreateStateCopy(); (new ConsoleBoardPrinter()).PrintBoard(state, PlayerTypeEnum.White); Console.WriteLine("{0} - {1} - {2} - {3} - {4}", moveResult.Success, moveResult.Error, moveResult.Taken, moveResult.MoveType, moveResult.Turn); } else Console.WriteLine("Not implemented."); Console.Write("> "); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } } }