private LastGameAction RunSubRounds(Dictionary <PlayerType, ConsoleBot> bots, GameState state, PlayerType playerToMove) { LastGameAction action = new LastGameAction(playerToMove, GameAction.Check); foreach (var tableSize in TableSizes) { // update the table. foreach (var kvp in bots) { kvp.Value.UpdateTable(Cards.Create(state.Table.Take(tableSize))); } action = RunBetting(bots, state, playerToMove); if (action.Action == GameAction.Fold) { return(action); } } return(action); }
private void SendResult(Dictionary <PlayerType, ConsoleBot> bots, GameState state, int pot, LastGameAction lastaction) { if (lastaction.Action != GameAction.Fold) { var hand1 = PokerHand.CreateFromHeadsUpOmaha(state.Table, state.Player1.Hand); var hand2 = PokerHand.CreateFromHeadsUpOmaha(state.Table, state.Player2.Hand); var compare = PokerHandComparer.Instance.Compare(hand1, hand2); if (compare > 0) { state.Result = RoundResult.Player1Wins; } else if (compare < 0) { state.Result = RoundResult.Player2Wins; } else { state.Result = RoundResult.Draw; } } else { state.Result = lastaction.Player == PlayerType.player1 ? RoundResult.Player2Wins : RoundResult.Player1Wins; } foreach (var kvp in bots) { kvp.Value.Result(state.Personalize(kvp.Key), pot, lastaction); } }