public void RecordMove(Move move) { Models.Utils.Log($"{_roundId}|{move.Player.Position}-{move.Player.Name} made a move:{move.Decision.DecisionType}-{move.Decision.ChipsAdded}"); var decisionPlayer = Players.First(p => p.Equals(move.Player)); if (move.Decision.DecisionType != DecisionType.Ante) { decisionPlayer.SetPolled(); } decisionPlayer.ChipsBetByStage[StageEnum] += move.Decision.ChipsAdded; MostChipsBetByRound[StageEnum] = Players.Max(p => p.ChipsBetByStage[StageEnum]); switch (move.Decision.DecisionType) { case DecisionType.Raise: case DecisionType.Reraise: foreach (var player in Players) { if (!player.Equals(decisionPlayer)) { player.ResetPolled(); } } break; case DecisionType.Fold: decisionPlayer.Fold(); break; case DecisionType.AllIn: decisionPlayer.AllIn(); break; } AllMoves.Add(move); switch (StageEnum) { case StageEnum.Preflop: PreflopMoves.Add(move); break; case StageEnum.Flop: FlopMoves.Add(move); break; case StageEnum.Turn: TurnMoves.Add(move); break; case StageEnum.River: RiverMoves.Add(move); break; default: throw new InvalidOleVariantTypeException($"Move not accepted in {StageEnum}"); } }
public void RecordMove(Move move) { var decisionPlayer = Players.First(p => p.Equals(move.Player)); if (move.Decision.DecisionType != DecisionType.Ante) { decisionPlayer.SetPolled(); } decisionPlayer.ChipsBetByStage[StageEnum] += move.Decision.ChipsAdded; MostChipsBetByRound[StageEnum] = Players.Max(p => p.ChipsBetByStage[StageEnum]); switch (move.Decision.DecisionType) { case DecisionType.Raise: case DecisionType.Reraise: foreach (var player in Players) { if (!player.Equals(decisionPlayer)) { player.ResetPolled(); } } break; case DecisionType.Fold: decisionPlayer.Fold(); break; case DecisionType.AllIn: decisionPlayer.AllIn(); break; } AllMoves.Add(move); switch (StageEnum) { case StageEnum.Preflop: PreflopMoves.Add(move); break; case StageEnum.Flop: FlopMoves.Add(move); break; case StageEnum.Turn: TurnMoves.Add(move); break; case StageEnum.River: RiverMoves.Add(move); break; default: throw new InvalidOperationException($"Move not accepted in {StageEnum}"); } if (move.Decision.DecisionType == DecisionType.Raise || move.Decision.DecisionType == DecisionType.Reraise) { if (StageEnum == StageEnum.Preflop) { PreflopRaiser = move.Player; } CurrentRaiser = move.Player; } int chipsToCall = MostChipsBetByRound[StageEnum] - move.Player.ChipsBetByStage[StageEnum]; if (move.Decision.DecisionType == DecisionType.AllIn && move.Decision.ChipsAdded > chipsToCall) { CurrentRaiser = move.Player; } if (move.Decision.DecisionType != DecisionType.Check && move.Decision.DecisionType != DecisionType.Fold) { IsRaised = true; } }