public Boolean ChecksBets(Turn.ActionType operation, int chip = 0) { if (!_dealer.IsEveryoneElseInAllIn()) { if (_players[_dealer._currPlayerIndex].TakeAction(_dealer, operation, chip)) { while (!_dealer.CheckIfRoundIsFinished(_players[_dealer._currPlayerIndex])) { if (_players[_dealer._currPlayerIndex].TakeAction(_dealer, operation, chip) != true) { Console.WriteLine("Betting Went Worng!"); return(false); } if (_players.Count == 1) { return(false); } } } else { Console.WriteLine("Betting Went Worng!"); return(false); } } else { _dealer.AllPlayerInAllIn(); } Console.WriteLine("Round" + _dealer._currRound + " is Finished"); Console.WriteLine("Pot Amount: " + _dealer.GetSumPots()); ShowPlayerChip(); return(true); }
public void NextPlayer(Player player, Turn.ActionType action, Chip chip) { _gameRounds[_currRound].AddTurn(new Turn(player, action, chip)); if (action != Turn.ActionType.Fold) { _currPlayerIndex = ((_currPlayerIndex + 1) % _players.Count); } else { _currPlayerIndex %= _players.Count; } ActiveLogger.Debug("the turn was passed to: " + _players[_currPlayerIndex].User.PlayerName); if (CheckIfRoundIsFinished(_players[_currPlayerIndex])) { _gameRounds.Add(new Round(_players)); _currRound++; ActiveLogger.Debug("new Round has began"); } while ((_players[_currPlayerIndex].AmIInAllIn) || (IsEveryoneElseInAllIn())) { _currPlayerIndex = ((_currPlayerIndex + 1) % _players.Count); ActiveLogger.Debug("the turn was passed to: " + _players[_currPlayerIndex].User.PlayerName); if (CheckIfRoundIsFinished(_players[_currPlayerIndex])) { _gameRounds.Add(new Round(_players)); _currRound++; ActiveLogger.Debug("new Round has began"); return; } } if (someoneFoldAndLast) { _lastPlayerInRound = player; someoneFoldAndLast = false; } }
public bool SetAction(Player player, Turn.ActionType action, int chip = 0) { switch (action) { case Turn.ActionType.Check: return(Check(player)); case Turn.ActionType.Fold: return(Fold(player)); case Turn.ActionType.Raise: return(Raise(player, new Chip(chip))); case Turn.ActionType.Call: return(Call(player)); case Turn.ActionType.AllIn: return(AllIn(player)); default: return(false); } }
public bool TakeAction(Dealer dealer, Turn.ActionType operation, int chip) { return(dealer.SetAction(this, operation, chip)); }