Skip to content

Commit

Permalink
MAJOR BUG! keep moves reference
Browse files Browse the repository at this point in the history
We reassign Moves to a new Empty List every time we make a move. Since we AREN'T referencing it in a for-each loop, it would get (supposedly) picked up by the GC. Meaning boardState.Moves[i] was referring to WRONG moves
  • Loading branch information
znxftw committed Dec 18, 2024
1 parent 41fa4e5 commit 39ba93d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Rudim/Search/Quiescence.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ public static int Search(BoardState boardState, int alpha, int beta, Cancellatio
MoveOrdering.SortMoves(boardState);


for (int i = 0; i < boardState.Moves.Count; ++i)
foreach (var t in boardState.Moves)
{
if (cancellationToken.IsCancellationRequested)
break;
Move move = boardState.Moves[i];
Move move = t;
if (!move.IsCapture())
break; // If sorted, once a quiet move is reached we won't need to visit the remaining nodes

Expand Down

0 comments on commit 39ba93d

Please sign in to comment.