public GameStage( Rules rules, PlayerGroupInfo playerGroupInfo, Action confirmAction) { Rules = rules; PlayerGroupInfo = playerGroupInfo; ConfirmAction = confirmAction; CurrentPlayer = GetRandomPlayer(); var deck = CardPile.CreateDeckPile(); var gameRound = new GameRound(Rules, PlayerGroupInfo, ConfirmAction, CurrentPlayer, deck); GameRoundList.Add(gameRound); }
public GameRound( Rules rules, PlayerGroupInfo playerGroup, Action confirmAction, PlayerInfo initialPlayer, CardPile deck) { Rules = rules; PlayerGroupInfo = playerGroup; ConfirmAction = confirmAction; InitialPlayer = initialPlayer; var playerList = PlayerGroupInfo.GetPlayerList(InitialPlayer.PlayerId); PlayerHandDictionary = playerList .ToDictionary(p => p.PlayerId, p => new CardPile(deck.Draw(9))); BetStage = new BetStage(Rules, PlayerGroupInfo, PlayerHandDictionary, InitialPlayer); ExpectedActionType = ActionType.BetAction; }
public void ProcessAction(ActionBase action) { Log.Information(action.ToString()); CurrentGameRound.ProcessAction(action); if (CurrentGameRound.RoundResult != null) { Log.Information(CurrentGameRound.RoundResult.ToString()); ConfirmAction?.Invoke(); GameResult = GetGameResult(); if (GameResult == null) { CurrentPlayer = PlayerGroupInfo.GetNextPlayer(CurrentPlayer.PlayerId); var deck = CardPile.CreateDeckPile(); var gameRound = new GameRound(Rules, PlayerGroupInfo, ConfirmAction, CurrentPlayer, deck); GameRoundList.Add(gameRound); } else { Log.Information(GameResult.ToString()); } } }
public static CardPile CreateDeckPile() { var cards = new List <Card> { new Card { CardSuit = CardSuit.Hearts, CardRank = CardRank.Six }, new Card { CardSuit = CardSuit.Hearts, CardRank = CardRank.Seven }, new Card { CardSuit = CardSuit.Hearts, CardRank = CardRank.Eight }, new Card { CardSuit = CardSuit.Hearts, CardRank = CardRank.Nine }, new Card { CardSuit = CardSuit.Hearts, CardRank = CardRank.Ten }, new Card { CardSuit = CardSuit.Hearts, CardRank = CardRank.Jack }, new Card { CardSuit = CardSuit.Hearts, CardRank = CardRank.Queen }, new Card { CardSuit = CardSuit.Hearts, CardRank = CardRank.King }, new Card { CardSuit = CardSuit.Hearts, CardRank = CardRank.Ace }, new Card { CardSuit = CardSuit.Diamonds, CardRank = CardRank.Six }, new Card { CardSuit = CardSuit.Diamonds, CardRank = CardRank.Seven }, new Card { CardSuit = CardSuit.Diamonds, CardRank = CardRank.Eight }, new Card { CardSuit = CardSuit.Diamonds, CardRank = CardRank.Nine }, new Card { CardSuit = CardSuit.Diamonds, CardRank = CardRank.Ten }, new Card { CardSuit = CardSuit.Diamonds, CardRank = CardRank.Jack }, new Card { CardSuit = CardSuit.Diamonds, CardRank = CardRank.Queen }, new Card { CardSuit = CardSuit.Diamonds, CardRank = CardRank.King }, new Card { CardSuit = CardSuit.Diamonds, CardRank = CardRank.Ace }, new Card { CardSuit = CardSuit.Spades, CardRank = CardRank.Six }, new Card { CardSuit = CardSuit.Spades, CardRank = CardRank.Seven }, new Card { CardSuit = CardSuit.Spades, CardRank = CardRank.Eight }, new Card { CardSuit = CardSuit.Spades, CardRank = CardRank.Nine }, new Card { CardSuit = CardSuit.Spades, CardRank = CardRank.Ten }, new Card { CardSuit = CardSuit.Spades, CardRank = CardRank.Jack }, new Card { CardSuit = CardSuit.Spades, CardRank = CardRank.Queen }, new Card { CardSuit = CardSuit.Spades, CardRank = CardRank.King }, new Card { CardSuit = CardSuit.Spades, CardRank = CardRank.Ace }, new Card { CardSuit = CardSuit.Clubs, CardRank = CardRank.Six }, new Card { CardSuit = CardSuit.Clubs, CardRank = CardRank.Seven }, new Card { CardSuit = CardSuit.Clubs, CardRank = CardRank.Eight }, new Card { CardSuit = CardSuit.Clubs, CardRank = CardRank.Nine }, new Card { CardSuit = CardSuit.Clubs, CardRank = CardRank.Ten }, new Card { CardSuit = CardSuit.Clubs, CardRank = CardRank.Jack }, new Card { CardSuit = CardSuit.Clubs, CardRank = CardRank.Queen }, new Card { CardSuit = CardSuit.Clubs, CardRank = CardRank.King }, new Card { CardSuit = CardSuit.Clubs, CardRank = CardRank.Ace } }; var cardPile = new CardPile(cards); cardPile.Shuffle(); return(cardPile); }