Offer Maia a draw (desktop and Android)
The shared rule (play::accepts_draw): she accepts when clearly worse or mated, or when about level (at most +0.2 for her) and her last three scores agree within 0.3; after a refusal, again two of her moves later. Her judge keeps the scores of her turns. Desktop: «½ Offer a draw» beside «Resign»; Android: a «Draw» button in the game's bar (labels may take two lines). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
0d7c0923fa
commit
b90bcdf3a3
18 changed files with 297 additions and 4 deletions
|
|
@ -48,7 +48,9 @@ impl GameSession {
|
|||
::play::Ending::Threefold => GameEnding::Threefold,
|
||||
::play::Ending::FiftyMoves => GameEnding::FiftyMoves,
|
||||
// No clocks and no resignations here: the app knows those itself.
|
||||
::play::Ending::Time { .. } | ::play::Ending::Resigned { .. } => return None,
|
||||
::play::Ending::Time { .. }
|
||||
| ::play::Ending::Resigned { .. }
|
||||
| ::play::Ending::DrawAgreed => return None,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -143,6 +145,30 @@ impl ResignJudge {
|
|||
.unwrap_or_else(|e| e.into_inner())
|
||||
.forget();
|
||||
}
|
||||
|
||||
/// Moves were taken back: the scores of Maia's turns gone are forgotten.
|
||||
pub fn forget_scores(&self) {
|
||||
self.judge
|
||||
.lock()
|
||||
.unwrap_or_else(|e| e.into_inner())
|
||||
.forget_scores();
|
||||
}
|
||||
|
||||
/// A draw may be offered now (not right after a refusal).
|
||||
pub fn may_offer_draw(&self) -> bool {
|
||||
self.judge
|
||||
.lock()
|
||||
.unwrap_or_else(|e| e.into_inner())
|
||||
.may_offer_draw()
|
||||
}
|
||||
|
||||
/// The user offers a draw: whether Maia accepts (the shared rule, `play::accepts_draw`).
|
||||
pub fn offer_draw(&self) -> bool {
|
||||
self.judge
|
||||
.lock()
|
||||
.unwrap_or_else(|e| e.into_inner())
|
||||
.offer_draw()
|
||||
}
|
||||
}
|
||||
|
||||
/// The weakest and strongest Maia on the phone (the small model's measured range).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue