From: Geoffrey Allott Date: Sun, 2 Jul 2023 20:49:05 +0000 (+0100) Subject: handle case where (1) a player plays his last card (2) all other players have passed... X-Git-Url: https://git.pointlesshacks.com/?a=commitdiff_plain;h=6b8e4489ce15358ad8e5e3b35189c45b7e62fa60;p=pokerwave.git handle case where (1) a player plays his last card (2) all other players have passed (3) there is no other score other than 1 for a go --- diff --git a/src/game/cribbage/mod.rs b/src/game/cribbage/mod.rs index 1f0d899..bc3f297 100644 --- a/src/game/cribbage/mod.rs +++ b/src/game/cribbage/mod.rs @@ -338,7 +338,12 @@ impl Game for Cribbage { if self.last_pegging_score().is_some() { self.state = State::ScoringPegging; } else { - self.active = self.next_player_still_in(); + if self.next_player_still_in().is_none() { + self.used_pegging_cards.append(&mut self.pegging_cards); + self.state = State::ScoringPegging; + } else { + self.active = self.next_player_still_in(); + } } Ok(()) } @@ -551,7 +556,7 @@ mod tests { let mut game = Cribbage::new(0, settings, seed); for action in actions { match action.action { - Action::Join { .. } | Action::PutInBox { .. } | Action::PlayCard { .. } | Action::Pass => { + Action::Join { .. } | Action::Leave { .. } | Action::PutInBox { .. } | Action::PlayCard { .. } | Action::Pass => { let validated = game.validate_action(action.clone()).unwrap(); assert_eq!(ValidatedUserAction(action), validated); game.take_action(validated).unwrap(); @@ -2929,4 +2934,191 @@ mod tests { test_game(actions, settings, seed); } + + #[test] + fn multiple_action_bug() { + let actions = r#"[ + {"timestamp":1688328516065,"username":"Geoff","action":{"action":"Join","seat":0,"chips":0}}, + {"timestamp":1688328882684,"username":"Geoff","action":{"action":"Leave"}}, + {"timestamp":1688328885567,"username":"Geoff","action":{"action":"Join","seat":0,"chips":0}}, + {"timestamp":1688328895472,"username":"Anne2","action":{"action":"Join","seat":1,"chips":0}}, + {"timestamp":1688328895474,"username":"Geoff","action":{"action":"NextToDeal"}}, + {"timestamp":1688328895475,"username":"Anne2","action":{"action":"ReceiveCard","card":{"rank":"Queen","suit":"Hearts"}}}, + {"timestamp":1688328895475,"username":"Geoff","action":{"action":"ReceiveCard","card":{"rank":"Five","suit":"Diamonds"}}}, + {"timestamp":1688328895476,"username":"Anne2","action":{"action":"ReceiveCard","card":{"rank":"Three","suit":"Spades"}}}, + {"timestamp":1688328895477,"username":"Geoff","action":{"action":"ReceiveCard","card":{"rank":"Seven","suit":"Spades"}}}, + {"timestamp":1688328895477,"username":"Anne2","action":{"action":"ReceiveCard","card":{"rank":"Queen","suit":"Clubs"}}}, + {"timestamp":1688328895478,"username":"Geoff","action":{"action":"ReceiveCard","card":{"rank":"Five","suit":"Hearts"}}}, + {"timestamp":1688328895479,"username":"Anne2","action":{"action":"ReceiveCard","card":{"rank":"Six","suit":"Clubs"}}}, + {"timestamp":1688328895479,"username":"Geoff","action":{"action":"ReceiveCard","card":{"rank":"Four","suit":"Hearts"}}}, + {"timestamp":1688328895480,"username":"Anne2","action":{"action":"ReceiveCard","card":{"rank":"Two","suit":"Hearts"}}}, + {"timestamp":1688328895480,"username":"Geoff","action":{"action":"ReceiveCard","card":{"rank":"Four","suit":"Spades"}}}, + {"timestamp":1688328895481,"username":"Anne2","action":{"action":"ReceiveCard","card":{"rank":"Ace","suit":"Hearts"}}}, + {"timestamp":1688328895482,"username":"Geoff","action":{"action":"ReceiveCard","card":{"rank":"Six","suit":"Diamonds"}}}, + {"timestamp":1688328895482,"username":"Geoff","action":{"action":"EndDeal"}}, + {"timestamp":1688328929001,"username":"Anne2","action":{"action":"PutInBox","card":{"rank":"Six","suit":"Clubs"}}}, + {"timestamp":1688328933815,"username":"Geoff","action":{"action":"PutInBox","card":{"rank":"Seven","suit":"Spades"}}}, + {"timestamp":1688328936437,"username":"Anne2","action":{"action":"PutInBox","card":{"rank":"Queen","suit":"Clubs"}}}, + {"timestamp":1688328938001,"username":"Geoff","action":{"action":"PutInBox","card":{"rank":"Four","suit":"Spades"}}}, + {"timestamp":1688328938002,"username":"Geoff","action":{"action":"CommunityCard","card":{"rank":"Three","suit":"Diamonds"}}}, + {"timestamp":1688328978906,"username":"Anne2","action":{"action":"PlayCard","card":{"rank":"Three","suit":"Spades"}}}, + {"timestamp":1688328985708,"username":"Geoff","action":{"action":"PlayCard","card":{"rank":"Four","suit":"Hearts"}}}, + {"timestamp":1688328993096,"username":"Anne2","action":{"action":"PlayCard","card":{"rank":"Two","suit":"Hearts"}}}, + {"timestamp":1688328993097,"username":"Anne2","action":{"action":"Score","points":3,"reason":"A run of three"}}, + {"timestamp":1688329008978,"username":"Geoff","action":{"action":"PlayCard","card":{"rank":"Six","suit":"Diamonds"}}}, + {"timestamp":1688329008981,"username":"Geoff","action":{"action":"Score","points":2,"reason":"Fifteen for two"}}, + {"timestamp":1688329016796,"username":"Anne2","action":{"action":"PlayCard","card":{"rank":"Queen","suit":"Hearts"}}}, + {"timestamp":1688329019231,"username":"Geoff","action":{"action":"PlayCard","card":{"rank":"Five","suit":"Hearts"}}}, + {"timestamp":1688329030825,"username":"Anne2","action":{"action":"PlayCard","card":{"rank":"Ace","suit":"Hearts"}}}, + {"timestamp":1688329030827,"username":"Anne2","action":{"action":"Score","points":2,"reason":"Thirty-one for two"}}, + {"timestamp":1688329034047,"username":"Geoff","action":{"action":"PlayCard","card":{"rank":"Five","suit":"Diamonds"}}}, + {"timestamp":1688329034048,"username":"Geoff","action":{"action":"Score","points":1,"reason":"One for a go"}}, + {"timestamp":1688329034049,"username":"Anne2","action":{"action":"RevealCard","card":{"rank":"Two","suit":"Hearts"}}}, + {"timestamp":1688329034049,"username":"Anne2","action":{"action":"RevealCard","card":{"rank":"Three","suit":"Spades"}}}, + {"timestamp":1688329034050,"username":"Anne2","action":{"action":"RevealCard","card":{"rank":"Queen","suit":"Hearts"}}}, + {"timestamp":1688329034050,"username":"Anne2","action":{"action":"RevealCard","card":{"rank":"Ace","suit":"Hearts"}}}, + {"timestamp":1688329034050,"username":"Anne2","action":{"action":"Score","points":12,"reason":"Fifteen two, fifteen four and a double-run for eight is 12"}}, + {"timestamp":1688329034051,"username":"Geoff","action":{"action":"RevealCard","card":{"rank":"Four","suit":"Hearts"}}}, + {"timestamp":1688329034051,"username":"Geoff","action":{"action":"RevealCard","card":{"rank":"Five","suit":"Diamonds"}}}, + {"timestamp":1688329034052,"username":"Geoff","action":{"action":"RevealCard","card":{"rank":"Five","suit":"Hearts"}}}, + {"timestamp":1688329034052,"username":"Geoff","action":{"action":"RevealCard","card":{"rank":"Six","suit":"Diamonds"}}}, + {"timestamp":1688329034053,"username":"Geoff","action":{"action":"Score","points":14,"reason":"Fifteen two, fifteen four and a double-run for ten is 14"}}, + {"timestamp":1688329034053,"username":"Geoff","action":{"action":"RevealCard","card":{"rank":"Four","suit":"Spades"}}}, + {"timestamp":1688329034053,"username":"Geoff","action":{"action":"RevealCard","card":{"rank":"Six","suit":"Clubs"}}}, + {"timestamp":1688329034054,"username":"Geoff","action":{"action":"RevealCard","card":{"rank":"Seven","suit":"Spades"}}}, + {"timestamp":1688329034054,"username":"Geoff","action":{"action":"RevealCard","card":{"rank":"Queen","suit":"Clubs"}}}, + {"timestamp":1688329034054,"username":"Geoff","action":{"action":"Score","points":0,"reason":"Nineteen"}}, + {"timestamp":1688329034055,"username":"Anne2","action":{"action":"NextToDeal"}}, + {"timestamp":1688329034055,"username":"Geoff","action":{"action":"ReceiveCard","card":{"rank":"Five","suit":"Diamonds"}}}, + {"timestamp":1688329034056,"username":"Anne2","action":{"action":"ReceiveCard","card":{"rank":"Six","suit":"Hearts"}}}, + {"timestamp":1688329034056,"username":"Geoff","action":{"action":"ReceiveCard","card":{"rank":"Seven","suit":"Clubs"}}}, + {"timestamp":1688329034056,"username":"Anne2","action":{"action":"ReceiveCard","card":{"rank":"Three","suit":"Hearts"}}}, + {"timestamp":1688329034057,"username":"Geoff","action":{"action":"ReceiveCard","card":{"rank":"Nine","suit":"Spades"}}}, + {"timestamp":1688329034057,"username":"Anne2","action":{"action":"ReceiveCard","card":{"rank":"Eight","suit":"Clubs"}}}, + {"timestamp":1688329034057,"username":"Geoff","action":{"action":"ReceiveCard","card":{"rank":"Two","suit":"Diamonds"}}}, + {"timestamp":1688329034058,"username":"Anne2","action":{"action":"ReceiveCard","card":{"rank":"Seven","suit":"Diamonds"}}}, + {"timestamp":1688329034058,"username":"Geoff","action":{"action":"ReceiveCard","card":{"rank":"Queen","suit":"Clubs"}}}, + {"timestamp":1688329034059,"username":"Anne2","action":{"action":"ReceiveCard","card":{"rank":"Six","suit":"Diamonds"}}}, + {"timestamp":1688329034059,"username":"Geoff","action":{"action":"ReceiveCard","card":{"rank":"Nine","suit":"Clubs"}}}, + {"timestamp":1688329034059,"username":"Anne2","action":{"action":"ReceiveCard","card":{"rank":"Ten","suit":"Hearts"}}}, + {"timestamp":1688329034060,"username":"Anne2","action":{"action":"EndDeal"}}, + {"timestamp":1688329077400,"username":"Anne2","action":{"action":"PutInBox","card":{"rank":"Three","suit":"Hearts"}}}, + {"timestamp":1688329078907,"username":"Anne2","action":{"action":"PutInBox","card":{"rank":"Ten","suit":"Hearts"}}}, + {"timestamp":1688329090270,"username":"Geoff","action":{"action":"PutInBox","card":{"rank":"Two","suit":"Diamonds"}}}, + {"timestamp":1688329091134,"username":"Geoff","action":{"action":"PutInBox","card":{"rank":"Queen","suit":"Clubs"}}}, + {"timestamp":1688329091136,"username":"Anne2","action":{"action":"CommunityCard","card":{"rank":"Four","suit":"Hearts"}}}, + {"timestamp":1688329096084,"username":"Geoff","action":{"action":"PlayCard","card":{"rank":"Nine","suit":"Spades"}}}, + {"timestamp":1688329098933,"username":"Anne2","action":{"action":"PlayCard","card":{"rank":"Six","suit":"Diamonds"}}}, + {"timestamp":1688329098934,"username":"Anne2","action":{"action":"Score","points":2,"reason":"Fifteen for two"}}, + {"timestamp":1688329101815,"username":"Geoff","action":{"action":"PlayCard","card":{"rank":"Nine","suit":"Clubs"}}}, + {"timestamp":1688329107461,"username":"Anne2","action":{"action":"PlayCard","card":{"rank":"Seven","suit":"Diamonds"}}}, + {"timestamp":1688329107462,"username":"Anne2","action":{"action":"Score","points":2,"reason":"Thirty-one for two"}}, + {"timestamp":1688329110397,"username":"Geoff","action":{"action":"PlayCard","card":{"rank":"Seven","suit":"Clubs"}}}, + {"timestamp":1688329118665,"username":"Anne2","action":{"action":"PlayCard","card":{"rank":"Eight","suit":"Clubs"}}}, + {"timestamp":1688329118666,"username":"Anne2","action":{"action":"Score","points":2,"reason":"Fifteen for two"}}, + {"timestamp":1688329121106,"username":"Geoff","action":{"action":"PlayCard","card":{"rank":"Five","suit":"Diamonds"}}}, + {"timestamp":1688329126203,"username":"Anne2","action":{"action":"PlayCard","card":{"rank":"Six","suit":"Hearts"}}}, + {"timestamp":1688329126204,"username":"Anne2","action":{"action":"Score","points":5,"reason":"A run of four and a go is five"}}, + {"timestamp":1688329126204,"username":"Geoff","action":{"action":"RevealCard","card":{"rank":"Five","suit":"Diamonds"}}}, + {"timestamp":1688329126204,"username":"Geoff","action":{"action":"RevealCard","card":{"rank":"Seven","suit":"Clubs"}}}, + {"timestamp":1688329126205,"username":"Geoff","action":{"action":"RevealCard","card":{"rank":"Nine","suit":"Clubs"}}}, + {"timestamp":1688329126205,"username":"Geoff","action":{"action":"RevealCard","card":{"rank":"Nine","suit":"Spades"}}}, + {"timestamp":1688329126206,"username":"Geoff","action":{"action":"Score","points":2,"reason":"A pair"}}, + {"timestamp":1688329126206,"username":"Anne2","action":{"action":"RevealCard","card":{"rank":"Six","suit":"Diamonds"}}}, + {"timestamp":1688329126206,"username":"Anne2","action":{"action":"RevealCard","card":{"rank":"Six","suit":"Hearts"}}}, + {"timestamp":1688329126207,"username":"Anne2","action":{"action":"RevealCard","card":{"rank":"Seven","suit":"Diamonds"}}}, + {"timestamp":1688329126207,"username":"Anne2","action":{"action":"RevealCard","card":{"rank":"Eight","suit":"Clubs"}}}, + {"timestamp":1688329126208,"username":"Anne2","action":{"action":"Score","points":10,"reason":"Fifteen two and a double-run for eight is 10"}}, + {"timestamp":1688329126208,"username":"Anne2","action":{"action":"RevealCard","card":{"rank":"Two","suit":"Diamonds"}}}, + {"timestamp":1688329126208,"username":"Anne2","action":{"action":"RevealCard","card":{"rank":"Three","suit":"Hearts"}}}, + {"timestamp":1688329126209,"username":"Anne2","action":{"action":"RevealCard","card":{"rank":"Ten","suit":"Hearts"}}}, + {"timestamp":1688329126209,"username":"Anne2","action":{"action":"RevealCard","card":{"rank":"Queen","suit":"Clubs"}}}, + {"timestamp":1688329126210,"username":"Anne2","action":{"action":"Score","points":7,"reason":"Fifteen two, fifteen four and a run of three is 7"}}, + {"timestamp":1688329126210,"username":"Geoff","action":{"action":"NextToDeal"}}, + {"timestamp":1688329126210,"username":"Anne2","action":{"action":"ReceiveCard","card":{"rank":"Five","suit":"Diamonds"}}}, + {"timestamp":1688329126211,"username":"Geoff","action":{"action":"ReceiveCard","card":{"rank":"Nine","suit":"Spades"}}}, + {"timestamp":1688329126211,"username":"Anne2","action":{"action":"ReceiveCard","card":{"rank":"Six","suit":"Hearts"}}}, + {"timestamp":1688329126211,"username":"Geoff","action":{"action":"ReceiveCard","card":{"rank":"Six","suit":"Diamonds"}}}, + {"timestamp":1688329126212,"username":"Anne2","action":{"action":"ReceiveCard","card":{"rank":"Three","suit":"Spades"}}}, + {"timestamp":1688329126212,"username":"Geoff","action":{"action":"ReceiveCard","card":{"rank":"Three","suit":"Hearts"}}}, + {"timestamp":1688329126212,"username":"Anne2","action":{"action":"ReceiveCard","card":{"rank":"Two","suit":"Clubs"}}}, + {"timestamp":1688329126213,"username":"Geoff","action":{"action":"ReceiveCard","card":{"rank":"Jack","suit":"Spades"}}}, + {"timestamp":1688329126213,"username":"Anne2","action":{"action":"ReceiveCard","card":{"rank":"Nine","suit":"Hearts"}}}, + {"timestamp":1688329126214,"username":"Geoff","action":{"action":"ReceiveCard","card":{"rank":"Queen","suit":"Clubs"}}}, + {"timestamp":1688329126214,"username":"Anne2","action":{"action":"ReceiveCard","card":{"rank":"Nine","suit":"Diamonds"}}}, + {"timestamp":1688329126214,"username":"Geoff","action":{"action":"ReceiveCard","card":{"rank":"Ten","suit":"Clubs"}}}, + {"timestamp":1688329126215,"username":"Geoff","action":{"action":"EndDeal"}}, + {"timestamp":1688329177042,"username":"Geoff","action":{"action":"PutInBox","card":{"rank":"Six","suit":"Diamonds"}}}, + {"timestamp":1688329177599,"username":"Geoff","action":{"action":"PutInBox","card":{"rank":"Nine","suit":"Spades"}}}, + {"timestamp":1688329192893,"username":"Anne2","action":{"action":"PutInBox","card":{"rank":"Three","suit":"Spades"}}}, + {"timestamp":1688329193894,"username":"Anne2","action":{"action":"PutInBox","card":{"rank":"Two","suit":"Clubs"}}}, + {"timestamp":1688329193896,"username":"Geoff","action":{"action":"CommunityCard","card":{"rank":"Nine","suit":"Clubs"}}}, + {"timestamp":1688329210274,"username":"Anne2","action":{"action":"PlayCard","card":{"rank":"Six","suit":"Hearts"}}}, + {"timestamp":1688329214384,"username":"Geoff","action":{"action":"PlayCard","card":{"rank":"Jack","suit":"Spades"}}}, + {"timestamp":1688329219872,"username":"Anne2","action":{"action":"PlayCard","card":{"rank":"Nine","suit":"Hearts"}}}, + {"timestamp":1688329224048,"username":"Geoff","action":{"action":"PlayCard","card":{"rank":"Three","suit":"Hearts"}}}, + {"timestamp":1688329228635,"username":"Anne2","action":{"action":"Pass"}}, + {"timestamp":1688329229924,"username":"Geoff","action":{"action":"Pass"}}, + {"timestamp":1688329229926,"username":"Geoff","action":{"action":"Score","points":1,"reason":"One for a go"}}, + {"timestamp":1688329239019,"username":"Anne2","action":{"action":"PlayCard","card":{"rank":"Nine","suit":"Diamonds"}}}, + {"timestamp":1688329240590,"username":"Geoff","action":{"action":"PlayCard","card":{"rank":"Queen","suit":"Clubs"}}}, + {"timestamp":1688329243080,"username":"Anne2","action":{"action":"PlayCard","card":{"rank":"Five","suit":"Diamonds"}}}, + {"timestamp":1688329244632,"username":"Geoff","action":{"action":"Pass"}}, + {"timestamp":1688329244633,"username":"Anne2","action":{"action":"Score","points":1,"reason":"One for a go"}}, + {"timestamp":1688329245992,"username":"Geoff","action":{"action":"PlayCard","card":{"rank":"Ten","suit":"Clubs"}}}, + {"timestamp":1688329245993,"username":"Geoff","action":{"action":"Score","points":1,"reason":"One for a go"}}, + {"timestamp":1688329245994,"username":"Anne2","action":{"action":"RevealCard","card":{"rank":"Five","suit":"Diamonds"}}}, + {"timestamp":1688329245995,"username":"Anne2","action":{"action":"RevealCard","card":{"rank":"Six","suit":"Hearts"}}}, + {"timestamp":1688329245995,"username":"Anne2","action":{"action":"RevealCard","card":{"rank":"Nine","suit":"Diamonds"}}}, + {"timestamp":1688329245996,"username":"Anne2","action":{"action":"RevealCard","card":{"rank":"Nine","suit":"Hearts"}}}, + {"timestamp":1688329245996,"username":"Anne2","action":{"action":"Score","points":12,"reason":"Fifteen two, fifteen four, fifteen six and three-of-a-kind for six is 12"}}, + {"timestamp":1688329245997,"username":"Geoff","action":{"action":"RevealCard","card":{"rank":"Three","suit":"Hearts"}}}, + {"timestamp":1688329245997,"username":"Geoff","action":{"action":"RevealCard","card":{"rank":"Ten","suit":"Clubs"}}}, + {"timestamp":1688329245998,"username":"Geoff","action":{"action":"RevealCard","card":{"rank":"Jack","suit":"Spades"}}}, + {"timestamp":1688329245998,"username":"Geoff","action":{"action":"RevealCard","card":{"rank":"Queen","suit":"Clubs"}}}, + {"timestamp":1688329245999,"username":"Geoff","action":{"action":"Score","points":4,"reason":"A run of four"}}, + {"timestamp":1688329245999,"username":"Geoff","action":{"action":"RevealCard","card":{"rank":"Two","suit":"Clubs"}}}, + {"timestamp":1688329246000,"username":"Geoff","action":{"action":"RevealCard","card":{"rank":"Three","suit":"Spades"}}}, + {"timestamp":1688329246001,"username":"Geoff","action":{"action":"RevealCard","card":{"rank":"Six","suit":"Diamonds"}}}, + {"timestamp":1688329246001,"username":"Geoff","action":{"action":"RevealCard","card":{"rank":"Nine","suit":"Spades"}}}, + {"timestamp":1688329246001,"username":"Geoff","action":{"action":"Score","points":6,"reason":"Fifteen two, fifteen four and a pair is 6"}}, + {"timestamp":1688329246002,"username":"Anne2","action":{"action":"NextToDeal"}}, + {"timestamp":1688329246002,"username":"Geoff","action":{"action":"ReceiveCard","card":{"rank":"Four","suit":"Spades"}}}, + {"timestamp":1688329246003,"username":"Anne2","action":{"action":"ReceiveCard","card":{"rank":"Five","suit":"Diamonds"}}}, + {"timestamp":1688329246004,"username":"Geoff","action":{"action":"ReceiveCard","card":{"rank":"Eight","suit":"Spades"}}}, + {"timestamp":1688329246004,"username":"Anne2","action":{"action":"ReceiveCard","card":{"rank":"Three","suit":"Hearts"}}}, + {"timestamp":1688329246005,"username":"Geoff","action":{"action":"ReceiveCard","card":{"rank":"Four","suit":"Clubs"}}}, + {"timestamp":1688329246005,"username":"Anne2","action":{"action":"ReceiveCard","card":{"rank":"Ace","suit":"Hearts"}}}, + {"timestamp":1688329246006,"username":"Geoff","action":{"action":"ReceiveCard","card":{"rank":"Jack","suit":"Hearts"}}}, + {"timestamp":1688329246006,"username":"Anne2","action":{"action":"ReceiveCard","card":{"rank":"Two","suit":"Diamonds"}}}, + {"timestamp":1688329246007,"username":"Geoff","action":{"action":"ReceiveCard","card":{"rank":"Queen","suit":"Clubs"}}}, + {"timestamp":1688329246007,"username":"Anne2","action":{"action":"ReceiveCard","card":{"rank":"Six","suit":"Hearts"}}}, + {"timestamp":1688329246008,"username":"Geoff","action":{"action":"ReceiveCard","card":{"rank":"Ten","suit":"Clubs"}}}, + {"timestamp":1688329246008,"username":"Anne2","action":{"action":"ReceiveCard","card":{"rank":"Five","suit":"Clubs"}}}, + {"timestamp":1688329246009,"username":"Anne2","action":{"action":"EndDeal"}}, + {"timestamp":1688329310816,"username":"Geoff","action":{"action":"PutInBox","card":{"rank":"Eight","suit":"Spades"}}}, + {"timestamp":1688329311299,"username":"Anne2","action":{"action":"PutInBox","card":{"rank":"Five","suit":"Diamonds"}}}, + {"timestamp":1688329312650,"username":"Anne2","action":{"action":"PutInBox","card":{"rank":"Five","suit":"Clubs"}}}, + {"timestamp":1688329315073,"username":"Geoff","action":{"action":"PutInBox","card":{"rank":"Queen","suit":"Clubs"}}}, + {"timestamp":1688329315075,"username":"Anne2","action":{"action":"CommunityCard","card":{"rank":"Ten","suit":"Hearts"}}}, + {"timestamp":1688329322368,"username":"Geoff","action":{"action":"PlayCard","card":{"rank":"Four","suit":"Clubs"}}}, + {"timestamp":1688329329098,"username":"Anne2","action":{"action":"PlayCard","card":{"rank":"Two","suit":"Diamonds"}}}, + {"timestamp":1688329331185,"username":"Geoff","action":{"action":"PlayCard","card":{"rank":"Ten","suit":"Clubs"}}}, + {"timestamp":1688329334678,"username":"Anne2","action":{"action":"PlayCard","card":{"rank":"Six","suit":"Hearts"}}}, + {"timestamp":1688329337003,"username":"Geoff","action":{"action":"PlayCard","card":{"rank":"Four","suit":"Spades"}}}, + {"timestamp":1688329344308,"username":"Anne2","action":{"action":"PlayCard","card":{"rank":"Ace","suit":"Hearts"}}}, + {"timestamp":1688329346454,"username":"Geoff","action":{"action":"Pass"}}, + {"timestamp":1688329361903,"username":"Anne2","action":{"action":"PlayCard","card":{"rank":"Three","suit":"Hearts"}}}, + {"timestamp":1688329361903,"username":"Anne2","action":{"action":"Score","points":1,"reason":"One for a go"}} + ]"#; + + let actions = serde_json::from_str(actions).unwrap(); + + let settings = r#"{"format":"Cribbage","title":"Wholesome Juncture","max_players":2,"target_score":121,"start_time":null}"#; + let settings = serde_json::from_str(settings).unwrap(); + let seed = r#"{"rng":"ChaCha8","seed":"dccf6052d4b5aae62cf148ee0a5fc38247d20b06877b73243e21ae2f6a5da19e"}"#; + let seed = serde_json::from_str(seed).unwrap(); + + test_game(actions, settings, seed); + } }