public function testDoubleBet() { $state = json_decode($this->gameState, true); $state['current_buy_in'] = 40; $this->assertEquals(maxDoubleBet($state), 40); }
public function postFlop($rainman, $game_state) { $me = $this->me($game_state); $cards = $me["hole_cards"]; $myRanks = array(); foreach ($cards as $card) { $myRanks[] = $this->cardInvert($card['rank']); } $myMax = max($myRanks); $communityCards = array(); foreach ($game_state['community_cards'] as $card) { $communityCards[] = $this->cardInvert($card['rank']); } $communityMax = max($communityCards); if ($this->headsUp($game_state)) { if ($rainman['rank'] == 1 && $rainman['value'] == $myMax && $myMax > $communityMax) { return holdIfCheap($game_state, 3); } elseif ($rainman['rank'] == 1 && $rainman['value'] == $myMax && $myMax == $communityMax) { return maxDoubleBet($game_state); } if ($rainman['rank'] == 2 && $rainman['value'] > 7) { return holdIfCheap($game_state, 4); } elseif ($rainman['rank'] == 2) { return maxDoubleBet($game_state); } if ($rainman['rank'] == 3 && $rainman['value'] <= 7) { if ($this->isRiver($game_state)) { } return minBet($game_state, 6); } if ($rainman['rank'] >= 3) { return 100000; } return holdIfCheap($game_state); } if ($rainman['rank'] == 0) { return 0; } if ($rainman['rank'] == 1 && $rainman['value'] == $myMax && $myMax >= $communityMax) { return maxDoubleBet($game_state); } if ($rainman['rank'] == 2 && $rainman['value'] > 7) { return maxDoubleBet($game_state); } if ($rainman['rank'] == 3 && $rainman['value'] <= 7) { return minBet($game_state); } elseif ($rainman['rank'] == 3) { return minBet($game_state, 6); } if ($rainman['rank'] > 3) { return 100000; } return holdIfCheap($game_state); }