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 ShouldUpdateThePositionInHistoryEntry() { var board = new Game.Board(); board.ParseFen(InitialBoardSetupWhiteToMove); // move to the same square var m = new Move(new Pawn { Square = 22 }, 22); board.MakeMove(m); // undo the side change board.HashSide(); board.History[0].PositionKey.Should().Be(board.PositionKey); }
public void ShouldNotHashOutTheEnPassantKeyIfItIsSet() { var board = new Game.Board(); board.ParseFen(InitialBoardSetupWhiteToMove); var initialPosKey = board.PositionKey; board.EnPassantSquare = 0; // move to the same square var m = new Move(new Pawn { Color = Color.White, Square = 22 }, 22); board.MakeMove(m); // undo the side change board.HashSide(); board.PositionKey.Should().Be(initialPosKey); }