refactor(core): streamline FEN and PGN export/import methods in ChessBoardView
This commit is contained in:
@@ -217,8 +217,12 @@ class GameEngine(
|
||||
if ruleSet.isCheckmate(currentContext) then
|
||||
val winner = currentContext.turn.opposite
|
||||
notifyObservers(CheckmateEvent(currentContext, winner))
|
||||
invoker.clear()
|
||||
currentContext = GameContext.initial
|
||||
else if ruleSet.isStalemate(currentContext) then
|
||||
notifyObservers(StalemateEvent(currentContext))
|
||||
invoker.clear()
|
||||
currentContext = GameContext.initial
|
||||
else if ruleSet.isCheck(currentContext) then
|
||||
notifyObservers(CheckDetectedEvent(currentContext))
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ class GameEngineNotationTest extends AnyFunSuite with Matchers:
|
||||
// Verify the captured pawn was found (computeCaptured EnPassant branch)
|
||||
val moveEvt = events.collect { case e: MoveExecutedEvent => e }.head
|
||||
moveEvt.capturedPiece shouldBe defined
|
||||
moveEvt.capturedPiece.get should include ("black")
|
||||
moveEvt.capturedPiece.get should include ("Black")
|
||||
|
||||
events.clear()
|
||||
engine.undo()
|
||||
|
||||
Reference in New Issue
Block a user