Skip to content

Commit c5c5f0b

Browse files
Merge pull request #222 from yongyi781/en-passant-fix
Fix en passant bug
2 parents 81054ba + 57ecb70 commit c5c5f0b

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/lib/engine/tensor.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@ function boardToTensor(fen: string): Float32Array {
8383
if (enPassantTarget !== '-') {
8484
const file = enPassantTarget.charCodeAt(0) - 'a'.charCodeAt(0)
8585
const rank = parseInt(enPassantTarget[1], 10) - 1 // Adjust rank indexing
86-
const row = 7 - rank // Invert rank to match tensor indexing
87-
const index = epChannel + row * 8 + file
86+
const index = epChannel + rank * 8 + file
8887
tensor[index] = 1.0
8988
}
9089

0 commit comments

Comments
 (0)