From 584a29618aebf186c25b27efb7715c1c70a9d730 Mon Sep 17 00:00:00 2001 From: Mattia Giambirtone Date: Tue, 23 Apr 2024 20:17:07 +0200 Subject: [PATCH] Minor fixups. Require nim 2.0.4 or higher to build --- Chess/nimfish.nimble | 2 +- Chess/nimfish/nimfishpkg/magics.nim | 6 +++--- Chess/nimfish/nimfishpkg/resources/magics.json | 2 +- Chess/nimfish/nimfishpkg/resources/movesets.json | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Chess/nimfish.nimble b/Chess/nimfish.nimble index 7937c72..36d55f0 100644 --- a/Chess/nimfish.nimble +++ b/Chess/nimfish.nimble @@ -12,7 +12,7 @@ bin = @["nimfish"] # Dependencies -requires "nim >= 2.0" +requires "nim >= 2.0.4" requires "jsony >= 1.1.5" diff --git a/Chess/nimfish/nimfishpkg/magics.nim b/Chess/nimfish/nimfishpkg/magics.nim index d392eeb..0e0d829 100644 --- a/Chess/nimfish/nimfishpkg/magics.nim +++ b/Chess/nimfish/nimfishpkg/magics.nim @@ -235,10 +235,10 @@ proc attemptMagicTableCreation(kind: PieceKind, square: Square, entry: MagicEntr ## at the given square using the provided magic entry. Returns ## (true, table) if successful, (false, empty) otherwise - # Initialize a new sequence with capacity 2^indexBits - result.table = newSeqOfCap[Bitboard](1 shl (64'u8 - entry.shift)) + # Initialize a new sequence with the right capacity + result.table = newSeqOfCap[Bitboard](1 shl (64'u8 - entry.shift)) # Just a fast way of doing 2 ** n result.success = true - for _ in 0..result.table.capacity: + for _ in 0..