- boardDouble (Form wie board): je Board entschieden, die bessere Bewertung (höhere Equity) gewinnt; Näherung offen dokumentiert (Topf geteilt, exakt wäre der Mittelwert). Ungleiche Länge, doppelte Karte -> ABSTAIN - ritOffered -> rit (ACCEPT/DECLINE/ABSTAIN) und ritReason: annehmen über dem Bruchpunkt, ohne offenen Call fairer Anteil, ohne Equity ABSTAIN - keine bestehenden Felder oder Typen geändert; Zusatzfelder werden nach der Spot-Prüfung gelesen - Tests: benannte Referenzwerte, ein Board verbessert/das andere nicht, pipeline_extras_neutral zeigt bitgleiche Antworten ohne die Felder (779) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
35 lines
1.2 KiB
Rust
35 lines
1.2 KiB
Rust
use super::decode_card::cards;
|
|
use crate::card::Card;
|
|
use crate::fault::Fault;
|
|
use crate::json::field::{join, optional};
|
|
use crate::json::Value;
|
|
|
|
const STREETS: [&str; 3] = ["FLOP", "TURN", "RIVER"];
|
|
|
|
/// A board object `{"FLOP": null|[cards], "TURN": …, "RIVER": …}` under `key`; absent
|
|
/// (or `null`) means `None`. Cards are concatenated in deal order regardless of key order.
|
|
fn board_at(root: &Value, key: &str) -> Result<Option<Vec<Card>>, Fault> {
|
|
let Some(object) = optional(root, "", key)? else {
|
|
return Ok(None);
|
|
};
|
|
let per_street = STREETS
|
|
.iter()
|
|
.map(|name| match optional(object, key, name)? {
|
|
Some(list) => cards(list, &join(key, name)),
|
|
None => Ok(Vec::new()),
|
|
})
|
|
.collect::<Result<Vec<_>, Fault>>()?;
|
|
Ok(Some(per_street.concat()))
|
|
}
|
|
|
|
/// `board`; absent means no cards.
|
|
pub fn board(root: &Value) -> Result<Vec<Card>, Fault> {
|
|
Ok(board_at(root, "board")?.unwrap_or_default())
|
|
}
|
|
|
|
/// Extension field `boardDouble`: a second board in the shape of `board`; absent or
|
|
/// `null` means a single board.
|
|
pub fn board_double(root: &Value) -> Result<Option<Vec<Card>>, Fault> {
|
|
board_at(root, "boardDouble")
|
|
}
|