Exemple #1
0
        private void PrintBoardState(ChessBoardState board)
        {
            Console.WriteLine("******************************************");
            Console.WriteLine((board.GetSideToMove() == ChessColor.White ? "White" : "Black") + "'s turn.");
            var moves = board.PossibleMoves().Select(x => x.ToString()).ToList();

            Console.WriteLine(board);
            int moveId = 0;

            foreach (var move in moves)
            {
                Console.WriteLine($"{moveId}: {move}");
                moveId++;
            }
        }
Exemple #2
0
        private void CheckPossibleMoves(ChessBoardState board, List <string> expectedMoves)
        {
            var moves = board.PossibleMoves().Select(x => x.ToString()).ToList();

            Console.WriteLine(board);
            foreach (var move in moves)
            {
                Console.WriteLine(move);
            }

            Assert.AreEqual(expectedMoves.Count(), moves.Count(), $"The move counts were different.  Expected {expectedMoves.Count()}, but returned {moves.Count()}.");
            for (int i = 0; i < expectedMoves.Count(); i++)
            {
                Assert.AreEqual(expectedMoves[i], moves[i]);
            }
        }