private PlayerAction River(double mtcWin, double mtcLoss) { if (_pokerGame.CanCall() && _pokerGame.CanRaise()) { if (mtcWin > mtcLoss) { return(PlayerAction.Raise); } } if (_pokerGame.CanCheck() && _pokerGame.CanRaise()) { if (mtcWin > mtcLoss) { return(PlayerAction.Raise); } return(PlayerAction.Check); } if (_pokerGame.CanCall() && !_pokerGame.CanCheck()) { if (mtcWin > mtcLoss) { return(PlayerAction.Call); } } return(CheckFold()); }
private PlayerAction MonteCarloOld() { WinConditions wc = new WinConditions(); RangeParser rc = new RangeParser(); EVCalculator ev = new EVCalculator(_pokerGame, _settings); OutsCalculator oc = new OutsCalculator(); List <string> RaisePreflop = new List <string> { "88+", "A2s+", "K5s+", "Q8s+", "J9s+", "T9s+", "98s", "87s", "A10o+", "K9o+", "Q9o+", "J9o+", "T9o" }; List <string> CallPreflop = new List <string> { "22+", "A2s+", "K2s+", "Q2s+", "J2s+", "T6s+", "97s+", "87s", "A2o+", "K2o+", "Q2o+", "J9o+", "T9o" }; List <Card> cardsToEvaluate = new List <Card>(_player.Cards); cardsToEvaluate.AddRange(_street); var handsToRaisePreflop = rc.Parse(RaisePreflop); var handsToCallPreflop = rc.Parse(CallPreflop).Except(handsToRaisePreflop).ToList(); var cardHand = _player.Cards; List <double> ExpectedValues = new List <double>(ev.CalculateMonteCarlo(cardHand, _hand, _settings)); var mtcBet = ExpectedValues[0]; var mtcCall = 0.00; if (ExpectedValues.Count > 1) { mtcCall = ExpectedValues[1]; } if (_pokerGame.CurrentRoundNumber() == 1) { if (ContainsCardHand(handsToRaisePreflop, cardHand)) { if (_player.IsSmallBlind) { if (_pokerGame.CanRaise()) { return(PlayerAction.Raise); } if (_pokerGame.CanCall()) { return(PlayerAction.Call); } } } if (ContainsCardHand(handsToCallPreflop, cardHand)) { if (_pokerGame.CanCall()) { return(PlayerAction.Call); } } } else if (_pokerGame.CurrentRoundNumber() == 2 || _pokerGame.CurrentRoundNumber() == 3) { // Flop + Turn var currentScore = wc.Evaluate(cardsToEvaluate); var compareOuts = oc.CompareOuts(_player.Cards, _street); if (currentScore <= Score.Pair) { if (_pokerGame.CanCall() && _pokerGame.CanRaise()) { if (mtcBet > mtcCall) { return(PlayerAction.Raise); } return(PlayerAction.Call); } if (_pokerGame.CanCheck() && _pokerGame.CanRaise()) { if (mtcBet > mtcCall) { return(PlayerAction.Raise); } return(PlayerAction.Call); } if (_pokerGame.CanCall() && !_pokerGame.CanCheck()) { if (mtcBet > 0.00) { return(PlayerAction.Call); } } } if (compareOuts > 0) { if (oc.CompareOuts(cardHand, _street) > 5) { if (_pokerGame.CanRaise()) { return(PlayerAction.Raise); } if (_pokerGame.CanCall()) { return(PlayerAction.Call); } } } } else if (_pokerGame.CurrentRoundNumber() == 4) { var currentScore = wc.Evaluate(cardsToEvaluate); if (currentScore >= Score.Pair) { if (_pokerGame.CanCall() && _pokerGame.CanRaise()) { if (mtcBet > mtcCall) { return(PlayerAction.Raise); } return(PlayerAction.Call); } if (_pokerGame.CanCheck() && _pokerGame.CanRaise()) { if (mtcBet > mtcCall) { return(PlayerAction.Raise); } return(PlayerAction.Call); } if (_pokerGame.CanCall() && !_pokerGame.CanCheck()) { if (mtcBet > 0.00) { return(PlayerAction.Call); } } } } if (_pokerGame.CanCheck()) { return(PlayerAction.Check); } return(PlayerAction.Fold); }
private void UpdateButtons() { buttonCall.Enabled = _game.CanCall(); buttonCheck.Enabled = _game.CanCheck(); buttonRaise.Enabled = _game.CanRaise(); }