Esempio n. 1
0
        public void cannotJumpOppositionDiagUpLeft()
        {
            Board b = TestBoard.createBoard();

            b.Place <Bishop>(Piece.PlayerColour.White, 4, 3);
            b.Place <Pawn>(Piece.PlayerColour.Black, 3, 2);
            b.Select(4, 3);
            b.Move(2, 1);
        }
Esempio n. 2
0
        public void cannotJumpOppositionDiagDownRight()
        {
            Board b = TestBoard.createBoard();

            b.Place <Bishop>(Piece.PlayerColour.White, 4, 3);
            b.Place <Pawn>(Piece.PlayerColour.Black, 5, 4);
            b.Select(4, 3);
            b.Move(6, 5);
        }
Esempio n. 3
0
        public void cannotTakeOwnPieceDiagUpLeft()
        {
            Board b = TestBoard.createBoard();

            b.Place <Bishop>(Piece.PlayerColour.White, 4, 3);
            b.Place <Pawn>(Piece.PlayerColour.White, 3, 2);
            b.Select(4, 3);
            b.Move(3, 2);
        }
Esempio n. 4
0
        public void cannotMoveIntoCheck()
        {
            Board b = TestBoard.createBoard();

            b.Place <King>(Piece.PlayerColour.White, 7, 3);
            b.Place <Rook>(Piece.PlayerColour.Black, 6, 1);
            b.Select(7, 3);
            b.Move(6, 3);
        }
Esempio n. 5
0
        public void canTakePiece()
        {
            Board b = TestBoard.createBoard();

            b.Place <Bishop>(Piece.PlayerColour.White, 4, 3);
            b.Place <Pawn>(Piece.PlayerColour.Black, 3, 4);
            b.Select(4, 3);
            b.Move(3, 4);
        }
Esempio n. 6
0
        public void canTakeOppositionPieceMovingUpRight()
        {
            Board b = TestBoard.createBoard();

            b.Place <King>(Piece.PlayerColour.White, 4, 3);
            b.Place <Pawn>(Piece.PlayerColour.Black, 3, 4);
            b.Select(4, 3);
            b.Move(3, 4);
        }
Esempio n. 7
0
        public void blackCanCastle()
        {
            Board b = TestBoard.createBoard();

            b.Place <King>(Piece.PlayerColour.Black, 0, 4);
            b.Place <Rook>(Piece.PlayerColour.Black, 0, 7);
            b.Select(0, 4);
            b.Move(0, 6);
        }
Esempio n. 8
0
        public void cannotTakeOwnPieceMovingDown()
        {
            Board b = TestBoard.createBoard();

            b.Place <King>(Piece.PlayerColour.White, 4, 3);
            b.Place <Pawn>(Piece.PlayerColour.White, 5, 3);
            b.Select(4, 3);
            b.Move(5, 3);
        }
Esempio n. 9
0
        public void cannotTakeOwnPieceDiagDownRight()
        {
            Board b = TestBoard.createBoard();

            b.Place <Bishop>(Piece.PlayerColour.White, 4, 3);
            b.Place <Pawn>(Piece.PlayerColour.White, 5, 4);
            b.Select(4, 3);
            b.Move(5, 4);
        }
Esempio n. 10
0
        public void cannotMoveKingIntoCheckWithPawn()
        {
            Board b = TestBoard.createBoard();

            b.Place <King>(Piece.PlayerColour.White, 7, 4);
            b.Place <Pawn>(Piece.PlayerColour.Black, 5, 6);
            b.Select(7, 4);
            b.Move(6, 5);
        }
Esempio n. 11
0
        public void whiteCanCastle()
        {
            Board b = TestBoard.createBoard();

            b.Place <King>(Piece.PlayerColour.White, 7, 4);
            b.Place <Rook>(Piece.PlayerColour.White, 7, 7);
            b.Select(7, 4);
            b.Move(7, 6);
        }
Esempio n. 12
0
        public void cannotTakeOwnPieceMovingForwardLeft()
        {
            Board b = TestBoard.createBoard();

            b.Place <King>(Piece.PlayerColour.White, 4, 3);
            b.Place <Pawn>(Piece.PlayerColour.White, 3, 2);
            b.Select(4, 3);
            b.Move(3, 2);
        }
Esempio n. 13
0
        public void cannotMoveSidewaysWhenInCheck()
        {
            Board b = TestBoard.createBoard();

            b.Place <King>(Piece.PlayerColour.White, 7, 3);
            b.Place <Rook>(Piece.PlayerColour.Black, 7, 0);
            b.Select(7, 3);
            b.Move(7, 4);
        }
Esempio n. 14
0
        public void whitePawnAutomaticallyPromotedToQueenWhenMovedToTopRow()
        {
            Board b = TestBoard.createBoard();

            b.Place <Pawn>(Piece.PlayerColour.White, 1, 2);
            b.GetFirstPiece <Pawn>(Piece.PlayerColour.White).AtStartPosition = false;
            b.Select(1, 2);
            b.Move(0, 2);
            Assert.IsInstanceOfType(b[0, 2].Piece, typeof(Queen));
        }
Esempio n. 15
0
        public void canGetPawnGetPossibleMovesOnTopRow()
        {
            Board b = TestBoard.createBoard();

            b.Place <Pawn>(Piece.PlayerColour.White, 0, 4);
            Pawn p = b.GetFirstPiece <Pawn>(Piece.PlayerColour.White);

            p.AtStartPosition = false;
            p.GetPossibleMoves();
        }
Esempio n. 16
0
        public void cannotCastleWithPieceInTheWay()
        {
            Board b = TestBoard.createBoard();

            b.Place <King>(Piece.PlayerColour.White, 7, 4);
            b.Place <Rook>(Piece.PlayerColour.White, 7, 7);
            b.Place <Bishop>(Piece.PlayerColour.White, 7, 5);
            b.Select(7, 4);
            b.Move(7, 6);
        }
Esempio n. 17
0
        public void blackPawnAutomaticallyPromotedToQuenWhenMoveToBottomRow()
        {
            Board b = TestBoard.createBoard();

            b.Place <Pawn>(Piece.PlayerColour.Black, 6, 2);
            b.GetFirstPiece <Pawn>(Piece.PlayerColour.Black).AtStartPosition = false;
            b.Select(6, 2);
            b.Move(7, 2);
            Assert.IsInstanceOfType(b[7, 2].Piece, typeof(Queen));
        }
Esempio n. 18
0
 public void canMoveBlackBishopDiagonallyDownRightNoObstructions()
 {
     for (int row = 3, col = 2; row >= 0 && col >= 0; row--, col--)
     {
         Board b = TestBoard.createBoard();
         b.Place <Bishop>(Piece.PlayerColour.Black, 4, 3);
         b.Select(4, 3);
         b.Move(row, col);
     }
 }
Esempio n. 19
0
 public void canMoveWhiteBishopDiagonallyDownRightNoObstructions()
 {
     for (int row = 5, col = 4; row < Board.NumOfRows && col < Board.NumOfCols; row++, col++)
     {
         Board b = TestBoard.createBoard();
         b.Place <Bishop>(Piece.PlayerColour.White, 4, 3);
         b.Select(4, 3);
         b.Move(row, col);
     }
 }
Esempio n. 20
0
 public void canMoveBlackBishopDiagonallyDownLeftNoObstructions()
 {
     for (int row = 3, col = 4; row >= 0 && col < Board.NumOfCols; row--, col++)
     {
         Board b = TestBoard.createBoard();
         b.Place <Bishop>(Piece.PlayerColour.Black, 4, 3);
         b.Select(4, 3);
         b.Move(row, col);
     }
 }
Esempio n. 21
0
 public void canMoveBlackBishipDiagonalUpRightNoObstructions()
 {
     for (int row = 5, col = 2; row < Board.NumOfRows && col >= 0; row++, col--)
     {
         Board b = TestBoard.createBoard();
         b.Place <Bishop>(Piece.PlayerColour.Black, 4, 3);
         b.Select(4, 3);
         b.Move(row, col);
     }
 }
Esempio n. 22
0
        public void cannotCastleOntoAPiece()
        {
            Board b = TestBoard.createBoard();

            b.Place <King>(Piece.PlayerColour.White, 7, 4);
            b.Place <Rook>(Piece.PlayerColour.White, 7, 7);
            b.Place <Knight>(Piece.PlayerColour.White, 7, 6);
            b.Select(7, 4);
            b.Move(7, 6);
        }
Esempio n. 23
0
        public void colourNotInStalemateWhenNoPossibleMovesAndInCheck()
        {
            Board b = TestBoard.createBoard();

            b.Place <King>(Piece.PlayerColour.White, 7, 7);
            b.Place <Queen>(Piece.PlayerColour.Black, 0, 6);
            b.Place <Rook>(Piece.PlayerColour.Black, 6, 0);
            b.Place <Rook>(Piece.PlayerColour.Black, 7, 0);
            Assert.IsFalse(b.InStalemate(Piece.PlayerColour.White));
        }
Esempio n. 24
0
        public void kingInCheckWhenPieceCanTakeIt()
        {
            Board b = TestBoard.createBoard();

            b.Place <King>(Piece.PlayerColour.White, 4, 3);
            b.Place <Queen>(Piece.PlayerColour.Black, 2, 3);
            King k = b[4, 3].Piece as King;

            Assert.IsTrue(k.InCheck);
        }
Esempio n. 25
0
 public void canMoveQueenDiagDownLeft()
 {
     for (int row = 5, col = 2; row < Board.NumOfRows && col >= 0; row++, col--)
     {
         Board b = TestBoard.createBoard();
         b.Place <Queen>(Piece.PlayerColour.White, 4, 3);
         b.Select(4, 3);
         b.Move(row, col);
     }
 }
Esempio n. 26
0
 public void canMoveQueenDiagUpRight()
 {
     for (int row = 3, col = 4; row >= 0 && col < Board.NumOfCols; row--, col++)
     {
         Board b = TestBoard.createBoard();
         b.Place <Queen>(Piece.PlayerColour.White, 4, 3);
         b.Select(4, 3);
         b.Move(row, col);
     }
 }
Esempio n. 27
0
 public void canMoveQueenDiagUpLeft()
 {
     for (int row = 3, col = 2; row >= 0 && col >= 0; row--, col--)
     {
         Board b = TestBoard.createBoard();
         b.Place <Queen>(Piece.PlayerColour.White, 4, 3);
         b.Select(4, 3);
         b.Move(row, col);
     }
 }
Esempio n. 28
0
        public void kingNotInCheckWhenOwnPieceBlockingOppositionPiece()
        {
            Board b = TestBoard.createBoard();

            b.Place <King>(Piece.PlayerColour.White, 4, 3);
            b.Place <Queen>(Piece.PlayerColour.Black, 2, 3);
            b.Place <Pawn>(Piece.PlayerColour.White, 3, 3);
            King k = b[4, 3].Piece as King;

            Assert.IsFalse(k.InCheck);
        }
Esempio n. 29
0
        public void kingInCheckMateWhenInCheckWithNoPossibleMoves()
        {
            Board b = TestBoard.createBoard();

            b.Place <King>(Piece.PlayerColour.White, 7, 3);
            b.Place <Rook>(Piece.PlayerColour.Black, 6, 0);
            b.Place <Queen>(Piece.PlayerColour.Black, 7, 0);
            King k = b.GetFirstPiece <King>(Piece.PlayerColour.White);

            Assert.IsTrue(k.InCheckMate);
        }
Esempio n. 30
0
        public void whitePawnAutoPromotionWithTakingPieceToTopRow()
        {
            Board b = TestBoard.createBoard();

            b.Place <Pawn>(Piece.PlayerColour.White, 1, 2);
            b.GetFirstPiece <Pawn>(Piece.PlayerColour.White).AtStartPosition = false;
            b.Place <Bishop>(Piece.PlayerColour.Black, 0, 3);
            b.Select(1, 2);
            b.Move(0, 3);
            Assert.IsInstanceOfType(b[0, 3].Piece, typeof(Queen));
        }