private void Allin() { //Check preconditions double highestOtherAllIn = 0; foreach (Player player in ActiveUnfoldedPlayers) //find highest all-in of the other players at the table { if (player != CurrentPlayer && player.Wallet.AmountOfMoney + LiveBets[player] > highestOtherAllIn) { highestOtherAllIn = player.Wallet.AmountOfMoney; } } if (CurrentPlayer.Wallet.AmountOfMoney > highestOtherAllIn) { throw new GameRulesException("all-in is bigger than the highest other player's all-in... use bet\raise move"); } if (CurrentPlayer.Wallet.AmountOfMoney == 0) { throw new WrongIOException("You're already all-in!!"); } //Make all-in if (CurrentPlayer.Wallet.AmountOfMoney + LiveBets[currentPlayer] <= TotalRaise) { Call(CurrentPlayer.Wallet.AmountOfMoney); } else { Call(0); if (LiveBets[currentPlayer] != totalRaise) { throw new WrongIOException("Didn't call right!"); } RaisePreconditions(CurrentPlayer.Wallet.AmountOfMoney + LiveBets[CurrentPlayer] - TotalRaise); Raise(CurrentPlayer.Wallet.AmountOfMoney + LiveBets[CurrentPlayer] - TotalRaise); } CurrentPlayer.AllIn(); }