Skip to content

Commit

Permalink
Reorder gamestate
Browse files Browse the repository at this point in the history
  • Loading branch information
eduherminio committed Jan 12, 2024
1 parent e0d2b80 commit 0e4bd95
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/Lynx/Model/GameState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
{
public readonly long ZobristKey;

public readonly byte Castle;

public readonly int CapturedPiece;

public readonly BoardSquare EnPassant;

public GameState(long zobristKey, int capturedPiece, byte castle, BoardSquare enpassant)
public readonly byte Castle;

public GameState(long zobristKey, int capturedPiece, BoardSquare enpassant, byte castle)
{
ZobristKey = zobristKey;
CapturedPiece = capturedPiece;
Castle = castle;
EnPassant = enpassant;
ZobristKey = zobristKey;
Castle = castle;
}
}
4 changes: 2 additions & 2 deletions src/Lynx/Model/Position.cs
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ public GameState MakeMove(Move move)

UniqueIdentifier ^= ZobristTable.CastleHash(Castle);

return new GameState(uniqueIdentifierCopy, capturedPiece, castleCopy, enpassantCopy);
return new GameState(uniqueIdentifierCopy, capturedPiece, enpassantCopy, castleCopy);
//var clone = new Position(this);
//clone.UnmakeMove(move, gameState);
//if (uniqueIdentifierCopy != clone.UniqueIdentifier)
Expand Down Expand Up @@ -436,7 +436,7 @@ public GameState MakeNullMove()
ZobristTable.SideHash()
^ ZobristTable.EnPassantHash((int)oldEnPassant);

return new GameState(oldUniqueIdentifier, -1, byte.MaxValue, oldEnPassant);
return new GameState(oldUniqueIdentifier, -1, oldEnPassant, byte.MaxValue);
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand Down

0 comments on commit 0e4bd95

Please sign in to comment.