Пример #1
0
        public void PawnNotPassedIfOpponentInSameOrAdjacentFile()
        {
            var pawnEvaluator = new PawnEvaluator();

            var whitePawnC7OpponentSameFileBoard = CreateBoardWithWhitePawnAt(new Position(File.C, Rank._7));

            whitePawnC7OpponentSameFileBoard.AddPiece(new PieceBuilder(PieceType.Pawn)
                                                      .As(PieceColor.Black)
                                                      .At(new Position(File.C, Rank._8))
                                                      .Create());

            var whitePawnC71 = whitePawnC7OpponentSameFileBoard.WhitePieces[0];

            Assert.False(pawnEvaluator.IsPawnPassed(whitePawnC71,
                                                    whitePawnC7OpponentSameFileBoard.WhitePieces, whitePawnC7OpponentSameFileBoard.BlackPieces));

            var whitePawnC7OpponentAdjacentFileBoard = CreateBoardWithWhitePawnAt(new Position(File.C, Rank._7));

            whitePawnC7OpponentAdjacentFileBoard.AddPiece(new PieceBuilder(PieceType.Pawn)
                                                          .As(PieceColor.Black)
                                                          .At(new Position(File.B, Rank._8))
                                                          .Create());

            var whitePawnC72 = whitePawnC7OpponentAdjacentFileBoard.WhitePieces[0];

            Assert.False(pawnEvaluator.IsPawnPassed(whitePawnC72,
                                                    whitePawnC7OpponentAdjacentFileBoard.WhitePieces, whitePawnC7OpponentAdjacentFileBoard.BlackPieces));
        }
Пример #2
0
        public void PawnNotPassedIfNotPastMiddleBoard()
        {
            var pawnEvaluator = new PawnEvaluator();

            var whitePawnC3Board = CreateBoardWithWhitePawnAt(new Position(File.C, Rank._3));
            var whitePawnC3      = whitePawnC3Board.WhitePieces[0];

            Assert.False(pawnEvaluator.IsPawnPassed(whitePawnC3,
                                                    whitePawnC3Board.WhitePieces, whitePawnC3Board.BlackPieces));
        }
Пример #3
0
        public void DetectsPassedPawns()
        {
            var pawnEvaluator = new PawnEvaluator();

            var whitePawnC7Board = CreateBoardWithWhitePawnAt(new Position(File.C, Rank._7));
            var whitePawnC7      = whitePawnC7Board.WhitePieces[0];

            Assert.True(pawnEvaluator.IsPawnPassed(whitePawnC7,
                                                   whitePawnC7Board.WhitePieces, whitePawnC7Board.BlackPieces));
        }