Resignation offer/decline flow - #146
Merged
Merged
Conversation
resign() completed the game unilaterally at the resigner's chosen points, letting a player facing a certain gammon escape for 1 point. Resignation is now an offer the opponent must answer, parallel to double/take: - offerResign(game, player, points): records a pending resignationOffer (new optional game field, types 1.0.5); stateKind unchanged while the offer is open - canRespondToResign / acceptResign / declineResign: only the opponent may respond; accept completes via the existing resign scoring (cube multiplier, Jacoby); decline clears the offer and play resumes resign() remains as the completion step and for callers that still complete directly.
Providers may answer a pending resignationOffer with accept/decline. Optional: callers treat a provider without it as accepting, which is the pre-offer-flow behavior.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
resign() completed the game unilaterally at the resigner's chosen points, letting a player facing a certain gammon escape for 1 point. Resignation is now an offer the opponent must answer, parallel to double/take:
offerResign(game, player, points)records a pendingresignationOffer(types 1.0.5); stateKind unchanged while the offer is opencanRespondToResign/acceptResign/declineResign: only the opponent may respond; accept completes via the existing resign scoring (cube multiplier, Jacoby); decline clears the offer and play resumesRobotAIProvidergains optionaldecideResignationResponse(accept/decline); callers treat a provider without it as accepting (pre-offer-flow behavior)resign() remains as the completion step. TDD: 14 new tests in resignation-offer.test.ts; the 13 cube-resign characterization tests are untouched and green. Full suite: no new failures (the 3 failing Board/gnuPositionId suites crash on import on the development baseline too).
Depends on types PR nodots/backgammon-types#69 (published as 1.0.5).