feat: enhance move history with piece type and capture status

This commit is contained in:
2026-04-01 11:02:02 +02:00
parent bf0b9862fc
commit 249a67b883
7 changed files with 59 additions and 31 deletions
@@ -43,6 +43,12 @@ class GUIObserver(private val boardView: ChessBoardView) extends Observer:
case e: PromotionRequiredEvent =>
boardView.showPromotionDialog(e.from, e.to)
case e: DrawClaimedEvent =>
boardView.updateBoard(e.board, e.turn)
showAlert(AlertType.Information, "Draw Claimed", "Draw claimed! The game is a draw.")
case e: FiftyMoveRuleAvailableEvent =>
boardView.showMessage("50-move rule available! The game is a draw.")
}
private def showAlert(alertType: AlertType, titleText: String, content: String): Unit =
@@ -49,6 +49,12 @@ class TerminalUI(engine: GameEngine) extends Observer:
case _: PromotionRequiredEvent =>
println("Promote to: q=Queen, r=Rook, b=Bishop, n=Knight")
synchronized { awaitingPromotion = true }
case _: DrawClaimedEvent =>
println("Draw claimed! The game is a draw.")
println()
print(Renderer.render(engine.board))
case _: FiftyMoveRuleAvailableEvent =>
println("50-move rule available! The game is a draw.")
/** Start the terminal UI game loop. */
def start(): Unit =