public void NewGame() { while (CommunityCards.Size != 0) { GameDeck.Return(CommunityCards.Draw()); } foreach (Player player in Players) { while (player.Hand.Size != 0) { GameDeck.Return(player.Hand.Draw()); } } for (int i = 0; i < ActivePlayers.Count; i++) { if (Players[i].Money > -500) { ActivePlayers[i] = true; } } GameDeck.Shuffle(); for (int i = 0; i < ActivePlayers.Count; i++) { if (ActivePlayers[i]) { Players[i].Hand.Return(GameDeck.Draw()); Players[i].Hand.Return(GameDeck.Draw()); } } IncrementBlindLocations(); }
public GameTable(IPlayer player, int minBet = 5) { NumberOfDecks = 8; SizeOfDeck = 52; MinBet = minBet; Dealer = new Dealer(); GameDeck = new GameDeck(NumberOfDecks); GameDeck.Shuffle(); Player = player; }
/*CONSTRUCTORS ----------------------------------------------------------------------------------------------------*/ /*Constructor: Default * 1) Creates a default, shuffled PlayingDeck object */ public Fortune() { this.Id = 3; this.GameType = "Fortune"; this.GameDeck = new TarotDeck(); GameDeck.Shuffle(); this.Players = new List <Player>(); this.Spread = new List <Card>(); this.DateToday = DateTime.Today; }// end Default constructor
/// <summary> /// Immutable Single player game. /// Shuffles the deck of cards /// Creates a list of players /// Adds Dealer as player[0] /// Adds another player /// Deals initial cards /// </summary> public void InitializeNewGame() { GameDeck.Shuffle(); Players = new Players(); Dealer = new Player(); Dealer.Name = "Dealer"; Players.Add(Dealer); Players.Add(new Player()); DealFirstRound(); }
public void InitializeNewGame(int NumberOfPlayers = 1) { GameDeck.Shuffle(); Players = new Players(); Dealer = new Player(); Dealer.Name = "Dealer"; Players.Add(Dealer); for (int i = 0; i < NumberOfPlayers; i++) { Players.Add(new Player()); } DealFirstCards(); }
public GameDeck CreateGameDeck(int gameDeckID, Deck deck) { List <int> cardRecordIDs = new List <int>(); foreach (Card card in deck.Cards) { cardRecordIDs.Add(GameCardManager.CreateCardRecord(card).CardRecordID); } GameDeck gameDeck = new GameDeck(gameDeckID, cardRecordIDs); gameDeck.Shuffle(100); return(gameDeck); }
/*PROPERTIES ------------------------------------------------------------------------------------------------------*/ /*CONSTRUCTORS ----------------------------------------------------------------------------------------------------*/ /*Constructor: Default * 1) Creates a default, shuffled PlayingDeck object * 2) Adds Player and Bot to List<Player> */ public GoFish() { this.Id = 2; this.GameType = "GoFish"; this.GameDeck = new PlayingDeck(); GameDeck.Shuffle(); this.DateToday = DateTime.Today; // can pass the selected Player to this list when creating the game window this.Players = new List <Player>(); Player bot = new Player("Botty"); // adding a Bot to play against for now Players.Add(bot); }// end Default constructor
} // This is for comparing cards, will be using the .CompareImg of the Card class /*CONSTRUCTORS ----------------------------------------------------------------------------------------------------*/ /*Constructor: Default * 1) Creates a default, shuffled MatchDeck object * 2) Sets LivesLeft to 3 * 3) Sets CardCount to 0 * 4) Initialises First as a null Card object */ public Match() { this.Id = 1; this.GameType = "Match"; this.GameDeck = new MatchDeck(); GameDeck.Shuffle(); this.LivesLeft = 3; this.CardCount = 0; this.First = null; this.DateToday = DateTime.Today; // NOTE: DON'T FORGET TO DO THIS // can pass the selected Player to this list when creating the game window this.Players = new List <Player>(); }// end Default constructor
public void InitializeNewGame(Players players) { GameDeck.Shuffle(); Players = new Players(); Dealer = new Player(); Dealer.Name = "Dealer"; Dealer.IsDealer = true; Players.Add(Dealer); foreach (Player player in players) { player.Hand = new Cards(); Players.Add(player); } DealFirstCards(); }
/// <summary> /// Mutable Single player game. /// Shuffles the deck of cards /// Creates a list of players /// Adds Dealer as player[0] /// Adds another player /// Deals initial cards /// </summary> /// <param name="NumberOfPlayers">Defaults to 1 but can be changed</param> public void InitializeNewGame(int NumberOfPlayers = 1) { GameDeck.Shuffle(); Players = new Players(); Dealer = new Player(); Dealer.Name = "Dealer"; Players.Add(Dealer); for (int i = 0; i < NumberOfPlayers; i++) { Players.Add(new Player()); } DealFirstRound(); if (NumberOfPlayers > 1) { IsMultiPlayer = true; } }
//resets game public void ResetGame() { lblHumanAttacking.Visible = true; lblComputerAttacking.Visible = false; lblHumanPlayer.Text = myPlayerOne.getName().ToString(); lblComputerPlayer.Text = myPlayerTwo.getName().ToString(); flpDeck.Controls.Clear(); flpComputerHand.Controls.Clear(); flpHumanHand.Controls.Clear(); flpRiver.Controls.Clear(); flpTrumpCard.Controls.Clear(); flpDiscardPile.Controls.Clear(); CardImageControl startingCardControl = new CardImageControl(); flpDeck.Controls.Add(startingCardControl); myDeck = new GameDeck(deckSize); myRiver = new GameRiver(); myHandOne = new PlayerHand(); myHandTwo = new PlayerHand(); myPlayerOne = new Player("PlayerOne", myHandOne, true, false); myPlayerTwo = new PlayerAI("PlayerTwo", myHandTwo, false, true); DeckDisplayList = new CardList(); HandOneDisplayList = new CardList(); HandTwoDisplayList = new CardList(); PlayerOneDisplayList = new CardList(); PlayerTwoDisplayList = new CardList(); RiverDisplayList = new CardList(); trumpCardDisplayList = new CardList(); discardDisplayList = new CardList(); myDeck.Shuffle(deckSize); txtDeckCardsRemaining.Text = myDeck.getCardsRemaining().ToString(); txtRiverCardsRemaning.Text = myRiver.getCardsRemaining().ToString(); txtDicardCardsRemaining.Text = discardDisplayList.Count().ToString(); txtRoundNumber.Text = roundNumber.ToString(); btnPickUp.Enabled = false; btnCeaseAttack.Enabled = true; roundNumber = 0; GameLog.Log("\nNEW GAME"); GameLog.Log("\n PlayerOne Win/Loss Ratio " + playerOneWins.ToString() + "/" + playerOneLosses.ToString()); GameLog.Log("\n PlayerTwo Win/Loss Ratio " + playerTwoWins.ToString() + "/" + playerTwoLosses.ToString() + "\n"); }