private bool DoPlayerBet(int gameId, int playerId, Bet bet, int value) { var game = TryGetGame(gameId); if (game is null) { return(false); } var playerInfo = game.PlayerByID[playerId]; if (game.CurrentPlayer != playerInfo.Position) { return(false); } if (game.BetHasBeenMade) { return(false); } var playerBet = new BetNode(playerId, playerInfo.Position, bet, value); game.RoundHistory.Add(playerBet); game.PlayerBets[playerInfo.Position] = playerBet; game.BetHasBeenMade = true; return(true); }
public void Execute(BetNode betNode) { var player = PlayerBySeat[betNode.Seat]; player.TableBet += betNode.Value; player.ChipBank -= betNode.Value; roundMaxBet = Math.Max(player.TableBet, roundMaxBet); }