From 58aa2e4764f90528270ae5b9a61de576260e5483 Mon Sep 17 00:00:00 2001 From: Kjetil Orbekk Date: Thu, 22 Dec 2022 19:09:17 -0500 Subject: Fixes to the engine enough that the random bot can finish a game --- protocol/src/simple_bots.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'protocol/src/simple_bots.rs') diff --git a/protocol/src/simple_bots.rs b/protocol/src/simple_bots.rs index 3df7b5d..501f1f4 100644 --- a/protocol/src/simple_bots.rs +++ b/protocol/src/simple_bots.rs @@ -147,4 +147,17 @@ mod tests { (AlwaysPassBiddingBot {}).bid(&player_view).await ); } + + #[tokio::test] + async fn play_until_completion() { + crate::tests::test_setup(); + let bot = RandomPlayingBot {}; + let mut result = PlayStateResult::InProgress(example_play_state()); + while let PlayStateResult::InProgress(play_state) = result { + info!("Play state: {play_state:#?}"); + let player_state = PlayStatePlayerView::from_play_state(&play_state, play_state.current_player()); + let card = bot.play(&player_state).await; + result = play_state.play(card).unwrap(); + } + } } -- cgit v1.2.3