Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
sotetsuk committed Sep 12, 2024
1 parent 7fa1023 commit 6106755
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pgx/_src/games/chess.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ def legal_labels(from_):
can_castle_queen_side = state.can_castle_queen_side[0]
can_castle_queen_side &= (b[0] == ROOK) & (b[8] == EMPTY) & (b[16] == EMPTY) & (b[24] == EMPTY) & (b[32] == KING)
can_castle_king_side = state.can_castle_king_side[0]
can_castle_king_side &= (b[32] == KING) & (b[40] == EMPTY) & (b[48] == EMPTY) & (b[56] == ROOK)
can_castle_king_side &= (b[32] == KING) & (b[40] == EMPTY) & (b[48] == EMPTY) & (b[56] == ROOK)
not_checked = ~jax.vmap(_is_attacked, in_axes=(None, 0))(state, jnp.int32([16, 24, 32, 40, 48]))
mask = mask.at[2364].set(mask[2364] | (can_castle_queen_side & not_checked[:3].all()))
mask = mask.at[2367].set(mask[2367] | (can_castle_king_side & not_checked[2:].all()))
Expand Down

0 comments on commit 6106755

Please sign in to comment.