public ActionOption GetOption(ActorState state) { if (state.AmountToCall == state.SmallBlind && state.Odds > 0.52) { return new ActionOption(GameAction.Call, state.AmountToCall * (state.Odds - 0.5)); } var options = new ActionOptions(); if (state.NoAmountToCall) { options.Add(new ActionOption(GameAction.Check, state.Odds * state.Pot, 1)); } else { options.Add(GameAction.Call); } if (state.AmountToCall != state.SmallBlind) { var step = 1 + ((state.MaximumRaise - state.BigBlind) >> 4); for (var raise = state.BigBlind; raise <= state.MaximumRaise; raise += step) { options.Add(GameAction.Raise(raise)); } } // Only add a fold if we have to call, and there is a change that we // can play a next round. if (!state.NoAmountToCall && state.OtherPot >= state.BigBlind) { options.Add(GameAction.Fold); } Node test = state.ToNode(); options.Sort(test, Nodes); var best = SelectOption(options); if (best.Action != GameAction.Fold) { if (best.Action != GameAction.Check) { test.Profit = (short)state.OwnPot; test.Action = best.Action; test.IsNew = true; Buffer.Add(test); } } else if(options.Count > 1) { best = new ActionOption(GameAction.Fold, options[1].Profit, options[1].Weight); } return best; }
protected override void AppendExitOption() { int lastKeyValue = ActionOptions.Keys.Last(); lastKeyValue++; ActionOptions.Add(lastKeyValue, new Option(Actions.DoNothing, "Exit / Back")); }
protected override void AppendExitOption() { ActionOptions.Add("Exit", new Option(Actions.DoNothing, "Exit / Back")); }