play: the tags of a game against Maia shared (desktop and Android)
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
vrubelroman 2026-10-26 01:14:40 +03:00
parent 68941d3341
commit 57cc4b2360
4 changed files with 73 additions and 34 deletions

View file

@ -25,7 +25,9 @@ pub use online::{
AccountLookup, DownloadState, OnlineAccount, OnlineDatabase, OnlineDownload, OnlineFailure,
OnlineProblem, OnlineTarget, Site,
};
pub use play::{GameEnding, MaiaPlayer, ResignJudge, hopeless_turns, maia_pause_ms, maia_range};
pub use play::{
GameEnding, MaiaPlayer, ResignJudge, hopeless_turns, maia_game_tags, maia_pause_ms, maia_range,
};
pub use review::{GameReview, MoveJudgement, ReviewMove, ReviewPoint, ReviewState, SideReview};
pub use session::{Edited, GameSession, own_create, own_remove, own_save};
pub use train::{TrainState, TrainStats, TrainVerdict, Trainer, trainer_set_file};

View file

@ -60,6 +60,26 @@ pub fn maia_pause_ms(ply: u32, only_move: bool) -> u64 {
::play::pause(None, ply as usize, only_move).as_millis() as u64
}
/// The tags of a game against Maia on the phone (no clocks): `event` in the app's
/// language; the user plays White when `user_white`.
#[uniffi::export]
pub fn maia_game_tags(
event: String,
user_white: bool,
user_name: String,
strength: u32,
) -> Vec<crate::Tag> {
let user = if user_white {
shakmaty::Color::White
} else {
shakmaty::Color::Black
};
::play::game_tags(&event, user, &user_name, None, strength, "-")
.into_iter()
.map(|(name, value)| crate::Tag { name, value })
.collect()
}
/// Maia's turns in a row with her position hopeless before she offers to resign.
#[uniffi::export]
pub fn hopeless_turns() -> u32 {