Skip to content

Commit

Permalink
code tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
lenguyenthanh committed Jul 16, 2023
1 parent a83a2ad commit 626a691
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/main/scala/Square.scala
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ object Square extends OpaqueInt[Square]:

inline def withRankOf(inline o: Square): Square = withRank(o.rank)
inline def withFileOf(inline o: Square): Square = withFile(o.file)
inline def bb: Bitboard = Bitboard(1L << s.value)
inline def bl: Long = 1L << s.value

inline def bb: Bitboard = Bitboard(1L << s.value)
inline def bl: Long = 1L << s.value

end extension

Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/variant/Standard.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ case object Standard
else genEvasions(king, situation, checkers) ::: enPassantMoves
val sliderBlockers = board.sliderBlockers(king, color)
if sliderBlockers.nonEmpty || enPassantMoves.nonEmpty then
candidates.filter(isSafe(situation, king, _, sliderBlockers))
candidates.filter(isSafe(situation, king, sliderBlockers))
else candidates

// Used for filtering candidate moves that would leave put the king in check.
def isSafe(situation: Situation, king: Square, move: Move, blockers: Bitboard): Boolean =
def isSafe(situation: Situation, king: Square, blockers: Bitboard)(move: Move): Boolean =
import situation.{ board, us, them }
if move.enpassant then
val newOccupied = (board.occupied ^ move.orig.bl ^ move.dest.withRankOf(move.orig).bl) | move.dest.bl
Expand Down

0 comments on commit 626a691

Please sign in to comment.