Skip to content

Commit

Permalink
Fixed bug
Browse files Browse the repository at this point in the history
  • Loading branch information
tsoj committed May 21, 2024
1 parent 06870e0 commit 499735f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/hashTable.nim
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,8 @@ func getPv*(ht: var HashTable, position: Position): seq[Move] =
var encounteredZobristKeys: seq[ZobristKey]
var currentPosition = position
while true:
for key in encounteredZobristKeys:
if key == currentPosition.zobristKey:
return result
if currentPosition.zobristKey in encounteredZobristKeys:
return result
encounteredZobristKeys.add(currentPosition.zobristKey)
let entry = ht.get(currentPosition.zobristKey)

Expand Down
2 changes: 1 addition & 1 deletion src/uai.nim
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ proc moves(position: Position, params: seq[string]): seq[Position] =

for i in 0 ..< params.len:
let move = params[i].toMove
if not move.isLegal(position):
if not move.isLegal(result[^1]):
raise newException(ValueError, "Illegal move: " & $move)
result.add result[^1].doMove(move)

Expand Down

0 comments on commit 499735f

Please sign in to comment.