Skip to content

Add time forfeit adjudication in play mode#57

Merged
fsmosca merged 1 commit intomasterfrom
copilot/add-time-forfeit-option
Mar 28, 2026
Merged

Add time forfeit adjudication in play mode#57
fsmosca merged 1 commit intomasterfrom
copilot/add-time-forfeit-option

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 28, 2026

When the user runs out of time during play mode, the game should be adjudicated as a loss, saved, and the engine quit — returning to neutral mode. This is configurable via Settings > Game.

Changes

  • Time forfeit detection — In the human move loop, after each 100ms tick, checks human_timer.elapse >= human_timer.base. Shows a popup notifying the player, then breaks out of the game loop.
  • Game result handling — Sets PGN Result to a loss for the forfeiting side and Termination to "{color} forfeits on time". Existing cleanup code handles engine quit and game save.
  • Settings checkbox — Added "Adjudicate game on time forfeit" checkbox under Settings > Game, backed by self.is_time_forfeit_enabled (default: True).
# Core detection logic in the human move loop
if (self.is_time_forfeit_enabled and
        human_timer.elapse >= human_timer.base):
    sg.Popup('{} loses on time!'.format(color.capitalize()), ...)
    is_user_time_forfeit = True
    break

@fsmosca fsmosca marked this pull request as ready for review March 28, 2026 20:53
@fsmosca fsmosca merged commit b30f1c1 into master Mar 28, 2026
@fsmosca fsmosca deleted the copilot/add-time-forfeit-option branch March 28, 2026 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants