feat(game): enhance game engine with resign functionality and optimize move generation
Build & Test (NowChessSystems) TeamCity build was queued

This commit is contained in:
2026-04-24 11:39:50 +02:00
parent 69851f1ea2
commit 3706ece936
7 changed files with 463 additions and 350 deletions
@@ -0,0 +1,9 @@
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxDsnsCAl0vQx7Vu9CLDZ
g0SG05NgUzu9T+3DTEaHGq60T2uriO8BenwyvsF3BnDqTbKf4voohZ1DNfzdbT1J
Fj8B62FrDmxcO+sp1/b5HUCJP6y2uSRCmzOHe5k7Pk1IEi72FgBpKXSRkFibRlVf
634g7mgsPZAQ9PJEsv4Qvm05T9L6+Gmq6N3bMVLKRXs4RhDhaFbYH9GtUg1eI0yH
YjGyRfqzW/nqVMstOLHt8CuPouq4p7eMzeDH3YHkxPm4GG5foCXMOd2DZrW0SCcr
7dhFeNVWzQ2m53eOhBzNQX+v3pgjVStsePhBRt2LyGfwkNzmqDgqWsMzSHRMY+cn
WQIDAQAB
-----END PUBLIC KEY-----
@@ -142,6 +142,8 @@ class GameEngine(
def redo(): Unit = synchronized(performRedo())
/** Resign from the game. The opponent wins. */
def resign(): Unit = synchronized(resign(currentContext.turn))
def resign(color: Color): Unit = synchronized {
if currentContext.result.isDefined then
notifyObservers(InvalidMoveEvent(currentContext, InvalidMoveReason.GameAlreadyOver))
@@ -150,7 +152,7 @@ class GameEngine(
pendingDrawOffer = None
stopClock()
invoker.clear()
notifyObservers(ResignEvent(currentContext, color.opposite))
notifyObservers(ResignEvent(currentContext, color))
}
/** Offer a draw. */