Summary - Curried candidateMoves, legalMoves, and applyMove in the RuleSet trait to separate (context) as the world being operated on from the computation parameter - Updated DefaultRules overrides and all internal call sites - Updated all external call sites: GameEngine, PgnParser, PgnExporter, ChessBoardView, and all affected tests Test plan - All existing tests pass (./gradlew build) - No behaviour changes — pure style refactoring, existing test suite is the regression guard Co-authored-by: LQ63 <lkhermann@web.de> Reviewed-on: #18 Reviewed-by: Janis <janis-e@gmx.de> Co-authored-by: Leon Hermann <lq@blackhole.local> Co-committed-by: Leon Hermann <lq@blackhole.local>
This commit was merged in pull request #18.
This commit is contained in:
@@ -178,7 +178,7 @@ class ChessBoardView(val stage: Stage, private val engine: GameEngine) extends B
|
||||
selectedSquare = Some(clickedSquare)
|
||||
highlightSquare(rank, file, PieceSprites.SquareColors.Selected)
|
||||
|
||||
val legalDests = engine.ruleSet.legalMoves(engine.context, clickedSquare)
|
||||
val legalDests = engine.ruleSet.legalMoves(engine.context)(clickedSquare)
|
||||
.collect { case move if move.from == clickedSquare => move.to }
|
||||
legalDests.foreach { sq =>
|
||||
highlightSquare(sq.rank.ordinal, sq.file.ordinal, PieceSprites.SquareColors.ValidMove)
|
||||
|
||||
Reference in New Issue
Block a user