feat: highlight legal moves on chess board interaction

This commit is contained in:
2026-04-01 10:41:12 +02:00
parent 407843409a
commit 98ff39890f
3 changed files with 144 additions and 17 deletions
@@ -212,6 +212,16 @@ class GameEngine(
notifyObservers(InvalidMoveEvent(currentBoard, currentHistory, currentTurn, "Error completing promotion."))
}
/** Load an arbitrary board position, clearing all history and undo/redo state. */
def loadPosition(board: Board, history: GameHistory, turn: Color): Unit = synchronized {
currentBoard = board
currentHistory = history
currentTurn = turn
pendingPromotion = None
invoker.clear()
notifyObservers(BoardResetEvent(currentBoard, currentHistory, currentTurn))
}
/** Reset the board to initial position. */
def reset(): Unit = synchronized {
currentBoard = Board.initial