summaryrefslogtreecommitdiff
path: root/protocol/src/simple_bots.rs
diff options
context:
space:
mode:
authorKjetil Orbekk <kj@orbekk.com>2022-12-22 19:09:17 -0500
committerKjetil Orbekk <kj@orbekk.com>2022-12-22 19:09:17 -0500
commit58aa2e4764f90528270ae5b9a61de576260e5483 (patch)
treeb8b9ce071637fa66335108e7430cce849f872933 /protocol/src/simple_bots.rs
parenta60500b47c81d15c9b970b58b1c871821dbe934a (diff)
Fixes to the engine enough that the random bot can finish a game
Diffstat (limited to 'protocol/src/simple_bots.rs')
-rw-r--r--protocol/src/simple_bots.rs13
1 files changed, 13 insertions, 0 deletions
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();
+ }
+ }
}