public BetPolicy(HandSnapshotModel parentModel) { Parent = parentModel; AllowedChildActions = new List<BetAction>(); HoldemHandRound round = Parent.NextPlayer == null ? (HoldemHandRound)((int)Parent.Round) + 1 : Parent.Round; int? index = Parent.NextPlayer == null ? parentModel.GetNextRoundStart() : Parent.NextPlayer; if (index != null) { AddFigures((int)index); AddOptions((int)index); } }
public BetTreeNodeModel(BetTreeModel tree, BetTreeNodeDisplay display, BetTreeNodeStyle style, HandSnapshotModel snapshot, BetTreeNodeModel parent, bool isDynamic) { this.Tree = tree; this.DisplayModel = display; this.StyleModel = style; this._parentSnapshot = snapshot; this.Snapshot = snapshot; this.Parent = parent; this.IsDynamic = isDynamic; this.Result = new BetTreeNodeResults(snapshot.Stacks.Length); this.Children = new ObservableCollection<BetTreeNodeModel>(); this.CanRemove = IsFixed() ? Visibility.Collapsed : Visibility.Visible; this.Info = new BetTreeNodeInfoModel(this, this.Data is ManualResultsModel); }
public void SetRoot() { ActiveStatus[] status = Table.Seats.Select(x => x.Player.Status).ToArray(); float[] bets = Table.Seats.Select(x => x.Player.Bet).ToArray(); float[] stacks = Table.Seats.Select(x => x.Player.Stack).ToArray(); bool[] active = Table.Seats.Select(x => x.Player.Active).ToArray(); HandRoot = new HandSnapshotModel(Table.StartRound, Table.Button, active, status, bets, stacks, null); }
public static HandSnapshotModel GetSnapshot(HandSnapshotModel lastAction, BetAction action, float amount) { if (lastAction.NextPlayer != null) { ActiveStatus[] status = lastAction.GetStatus(); float[] bets = lastAction.GetBets(); float[] stacks = lastAction.GetStacks(); bool[] active = lastAction.GetActive(); ApplyBet(action, (int)lastAction.NextPlayer, amount, status, bets, stacks); return new HandSnapshotModel(lastAction.Round, lastAction.Button, active, status, bets, stacks, lastAction.NextPlayer); } else { if (lastAction.IsHandEnd) { return lastAction; } else { HoldemHandRound round = (HoldemHandRound)(((int)lastAction.Round) + 1); ActiveStatus[] status = GetNextRoundStatus(lastAction.GetStatus()); float[] bets = lastAction.GetBets(); float[] stacks = lastAction.GetStacks(); bool[] active = lastAction.GetActive(); int start = BetPolicyService.GetRoundStart(round, lastAction.Button, status.Length); start = (int)GetNextActivePlayer(status, bets, (int)round); ApplyBet(action, start, amount, status, bets, stacks); return new HandSnapshotModel(round, lastAction.Button, active, status, bets, stacks, start); } } }
public BetTreeNodeModel(BetTreeModel tree, BetTreeNodeDisplay display, BetTreeNodeStyle style, HandSnapshotModel snapshot, BetTreeNodeModel parent) : this(tree, display, style, snapshot, parent, false) { }
public BetTreeNodeModel(BetTreeModel tree, BetTreeNodeDisplay display, BetTreeNodeStyle style, HandSnapshotModel snapshot) : this(tree, display, style, snapshot, null) { }
public BetTreeNodeModel GetRootNode(BetTreeModel tree, HandSnapshotModel snapshot) { BetTreeNodeStyle style = _roundStyles[snapshot.Round]; BetTreeNodeModel model = new BetTreeNodeModel(tree, _nodeStyles[typeof(RootNodeDataModel)], style, snapshot); ObservableCollection<BetTreeDataNodeMeta> metaList = new ObservableCollection<BetTreeDataNodeMeta>(); metaList.Add(new BetTreeDataNodeMeta(ROOT_NODE_META, new RootNodeDataModel())); model.AllowedNodeTypes = metaList; model.Meta = ROOT_NODE_META; model.AddNode += tree.OnAddNode; model.EditNode += tree.OnEditNode; model.DeleteNode += tree.OnDeleteNode; model.ShowWizard += tree.OnShowWizard; return model; }