예제 #1
0
        public static void ShouldDetectWhenMoveWillResultInStalemate()
        {
            Rook blackRook = (Rook)board['a', 3].Piece.Object;

            Move move = new Move(blackPlayer, blackRook, board['a', 2]);

            move.GetMoveType().Should().Contain(Move.MoveType.Stalemate);
        }
예제 #2
0
        public static void ShouldDetectWhenMoveWillNotResultInCheckmateOrStalemate()
        {
            board['a', 8].Piece = Optional <IPiece> .Empty;
            Rook blackRook = (Rook)board['a', 3].Piece.Object;

            Move move = new Move(blackPlayer, blackRook, board['a', 2]);

            move.GetMoveType().Should().NotContain(Move.MoveType.Checkmate);
            move.GetMoveType().Should().NotContain(Move.MoveType.Stalemate);
        }
예제 #3
0
        public static void ShouldCreateMatchingMove()
        {
            Player anotherBlackPlayer = new SimpleAI(color: Color.black);
            Piece  anotherRook        = new Rook(color: Color.black);
            var    startingSquare     = new Square(file: 'a', rank: 1);

            startingSquare.Piece = anotherRook;
            var destination = new Square(file: 'c', rank: 1);

            var anotherMove = new Move(anotherBlackPlayer, anotherRook, destination);

            Move move = Move.CreateMatchingMoveForGame(anotherMove, game);

            move.Player.Should().Be(blackPlayer);
            move.Piece.Should().Be(board['a', 1].Piece.Object);
            move.Destination.Should().Be(board['c', 1]);
            move.Board.Should().Equal(board);
        }