Exemplo 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);
        }
Exemplo 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);
        }
Exemplo 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);
        }
Exemplo 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);
        }
Exemplo 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);
        }
Exemplo 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);
        }
Exemplo 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);
        }
Exemplo 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);
        }
Exemplo 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);
        }
Exemplo 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);
        }
Exemplo 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);
        }
Exemplo 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);
        }
Exemplo 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);
        }
Exemplo 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));
        }
Exemplo 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();
        }
Exemplo 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);
        }
Exemplo 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));
        }
Exemplo 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);
     }
 }
Exemplo 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);
     }
 }
Exemplo 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);
     }
 }
Exemplo 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);
     }
 }
Exemplo 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);
        }
Exemplo 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));
        }
Exemplo 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);
        }
Exemplo 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);
     }
 }
Exemplo 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);
     }
 }
Exemplo 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);
     }
 }
Exemplo 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);
        }
Exemplo 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);
        }
Exemplo 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));
        }