From 79051b51fc4a70e354b96545ea91f9e630ac9aaf Mon Sep 17 00:00:00 2001 From: Jeff Wu Date: Wed, 30 Mar 2016 02:20:34 -0700 Subject: [PATCH] tweaks --- README.md | 2 +- src/strategies/information.rs | 26 ++++++++++++-------------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 10fb769..d3202c1 100644 --- a/README.md +++ b/README.md @@ -53,5 +53,5 @@ Currently, on seeds 0-9999, we have: | 2p | 3p | 4p | 5p | ----------|---------|---------|---------|---------| cheating | 24.8600 | 24.9781 | 24.9715 | 24.9583 | -info | 15.15 | 22.79 | 24.604 | 24.778 | +info | 17.136 | 23.181 | 24.63 | 24.805 | diff --git a/src/strategies/information.rs b/src/strategies/information.rs index 82ea54b..5aae85f 100644 --- a/src/strategies/information.rs +++ b/src/strategies/information.rs @@ -435,10 +435,12 @@ impl InformationPlayerStrategy { } fn get_play_score(&self, view: &BorrowedGameView, card: &Card) -> i32 { - for player in view.board.get_players() { - if player != self.me { - if view.has_card(&player, card) { - return 1; + if view.board.deck_size() > 0 { + for player in view.board.get_players() { + if player != self.me { + if view.has_card(&player, card) { + return 1; + } } } } @@ -574,9 +576,9 @@ impl InformationPlayerStrategy { let player_amt = (hint_info.value - hint_type) / 3; let hint_player = (self.me + 1 + player_amt) % view.board.num_players; - let card_index = 0; let hand = view.get_hand(&hint_player); + let card_index = hand.len() -1; let hint_card = &hand[card_index]; let hinted = match hint_type { @@ -601,6 +603,7 @@ impl InformationPlayerStrategy { if let Some(hinted) = hinted_opt { hinted } else { + // Technically possible, but never happens panic!("Found nothing to hint!") } } @@ -621,7 +624,8 @@ impl InformationPlayerStrategy { let hinter = self.last_view.board.player; let player_amt = (view.board.num_players + hint.player - hinter - 1) % view.board.num_players; - let hint_type = if result[0] { + let card_index = result.len() - 1; + let hint_type = if result[card_index] { match hint.hinted { Hinted::Value(_) => 0, Hinted::Color(_) => 1, @@ -686,14 +690,8 @@ impl PlayerStrategy for InformationPlayerStrategy { }); let maybe_play = risky_playable_cards[0]; - if view.board.lives_remaining > 2 { - if maybe_play.2 > 0.5 { - return TurnChoice::Play(maybe_play.0); - } - } else { - if maybe_play.2 > 0.7 { - return TurnChoice::Play(maybe_play.0); - } + if maybe_play.2 > 0.7 { + return TurnChoice::Play(maybe_play.0); } } }