Project 1

Note: You should not use class for this project

Develop a simple poker game. You need to design appropriate variables for 1) the game machine and 2) the players. The former should include variables representing the amount of money in the pot and remaining cards that havent been revealed. The latter should include the player name, player number, and the amount of money on his/her account. You need to add additional variables in the program if you feel necessary. The game plays as following.

a)In the beginning of the game, it will ask you how many players. Each player will have an initial $100 on his/her account. The initial amount of money in the pot of the game machine is $50. Also, the game machine will generate a random sequence of 52 cards. You can ignore the type of a card (i.e., spades, hearts, diamonds, and clubs) and just have 4 of each number in the range of 1 to 13.

b)The game plays round by round. In each round, the game machine will show the two cards in the front of the card sequence (suppose it is 8 and Q) and remove them from the card sequence. Then, all players bet sequentially.

  • i.A player will first put down his/her deposit (smaller than the amount on his/her account) and then pick up the card in the front of the card sequence. The minimal deposit is $1.
  • ii.If the card is in between the two cards shown by the machine, the player wins (e.g., if the card is J). He/she will win the amount of money he/she previously deposited from the pot of the game machine. If the amount of money in the pot is smaller than his/her deposit, he/she can only win the amount of money in the pot.
  • iii.If the card is NOT in between the two cards shown by the machine (e.g., if the card is 8), the player loses. Then the money he/she deposited will be subtracted from her account and be added to the pot.
  • iv.If the player wins, the current round finishes. The game will repeat another round.

c)When the number of remaining cards in the card sequence is smaller than 3. The game machine will shuffle and generate another random sequence of 52 cards. Then the game will continue from the front of the new card sequence. You need to prompt so on the console when it happens.

d)Note: whenever the amount of money in the pot becomes 0, each player has to pay $10 to the pot from her account, so that the game can continue. You need to give a hint on console when this happens.

e)Note: If the amount of money on a players account becomes 0, he/she loses the game and will be kicked out. This player will no longer be involved in further rounds of the game. You need to give a hint on console when a player is kicked out.

Project 2

Note: Please submit to the same submission folder of your first project

The task of this project is to further modularize the poker game you have implemented in the first project through class and multi-file programming. You will need to implement the following.

1.Design three classes in your program:

  • a.GameConsole class: which simulates a game console that oversees the whole game. We still assume that the game can take at most 10 players.
  • b.Deck class: which simulates a deck of cards.
  • c.Player class: which simulates one player

You will need to design appropriate data members and function members for the three classes. Obviously, the GameConsole class will contain an object of the Deck class and an array of the Player class as data members, which are used to store the deck of cards and players information, respectively.

2.Put the three classes in three pairs of header and source files. Specifically,

  • a.GameConsole.h and GameConsole.cpp
  • b.Deck.h and Deck.cpp
  • c.Player.h and Player.cpp

3.With appropriate design of the three classes, your main program should look super concise. An example could be the following

int main() {
GameConsole gGamesole; //declare the game
gGamesole.getPlayerInfo(); //ask how many players and get player information
while (gGamesole.good()) {//check whether the game should continue or not
gGamesole.playOneRound(); //play one round
}
return 0;
}

Obviously, you have to carefully design what should the playOneRound() function do and what should the good() function check. The game logic is the same as the in the first project: 1) Players bet sequentially; 2) The deck would change the cards as long as one player wins; 3) A shuffle is needed when the remaining amount of cards is <=3; 4) A player quits if his/her money is <=0; 5) The game stops when either all players have lost their money or all have chosen to quit.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.