Skip to content

Commit

Permalink
Reorder GameState constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
eduherminio committed Jan 8, 2024
1 parent 1123958 commit b013363
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Lynx/Model/GameState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public readonly struct GameState

public readonly BoardSquare EnPassant;

public GameState(sbyte capturedPiece, byte castle, BoardSquare enpassant, long zobristKey)
public GameState(long zobristKey, sbyte capturedPiece, byte castle, BoardSquare enpassant)
{
CapturedPiece = capturedPiece;
Castle = castle;
Expand Down
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(capturedPiece, castleCopy, enpassantCopy, uniqueIdentifierCopy);
return new GameState(uniqueIdentifierCopy, capturedPiece, castleCopy, enpassantCopy);
//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(-1, byte.MaxValue, oldEnPassant, oldUniqueIdentifier);
return new GameState(oldUniqueIdentifier, -1, byte.MaxValue, oldEnPassant);
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand Down

0 comments on commit b013363

Please sign in to comment.