public void ShouldHashOutASinglePiece() { var board = new Game.Board(); var piece = new Pawn { Square = 1 }; board.HashPiece(piece); board.HashPiece(piece); board.PositionKey.Should().Be(0); }
public void ShouldHashOutASecondPiece() { var board = new Game.Board(); var pawn1 = new Pawn { Square = 1 }; var pawn2 = new Pawn { Square = 2 }; board.HashPiece(pawn2); board.HashPiece(pawn1); board.HashPiece(pawn2); board.PositionKey.Should().Be(HashPawnSquareOne); }
public void ShouldHashInTheSide() { var board = new Game.Board(); var pawn1 = new Pawn { Square = 1 }; board.HashSide(); board.HashPiece(pawn1); board.PositionKey.Should().NotBe(HashPawnSquareOne); board.HashSide(); board.PositionKey.Should().Be(HashPawnSquareOne); }
public void ShouldHashInAnEnPassentSquare() { var board = new Game.Board(); const int enPassantSquare = 42; var pawn1 = new Pawn { Square = 1 }; board.HashEnPassant(enPassantSquare); board.HashPiece(pawn1); board.PositionKey.Should().NotBe(HashPawnSquareOne); board.HashEnPassant(enPassantSquare); board.PositionKey.Should().Be(HashPawnSquareOne); }
public void ShouldHashPieceIn() { var board = new Game.Board(); board.ParseFen(InitialBoardSetupWhiteToMoveNoWhiteRooksPawn); int initialPositionKey = board.PositionKey; var from = new Rook { Square = 21, Color = Color.White }; var to = new Rook { Square = 31, Color = Color.White }; board.CastlePiece(from, to); board.HashPiece(from); board.HashPiece(to); var positionKey = board.PositionKey; positionKey.Should().Be(initialPositionKey); }
public void ShouldHashPieceIn() { var board = new Game.Board(); board.ParseFen(InitialBoardSetupWhiteToMoveNoWhiteRook); int initialPositionKey = board.PositionKey; board.AddPiece(new Rook { Square = 21, Color = Color.White }); board.HashPiece(board.Squares[21]); var positionKey = board.PositionKey; positionKey.Should().Be(initialPositionKey); }
public void ShouldHashOutPiece() { var board = new Game.Board(); board.ParseFen(InitialBoardSetupWhiteToMove); int initialPositionKey = board.PositionKey; board.ClearPiece(board.Squares[21]); board.HashPiece(new Rook { Square = 21 }); var positionKey = board.PositionKey; initialPositionKey.Should().Be(positionKey); }