

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
An assignment for a computer science course (cse294b) where students are required to build a poker game using classes and multiple files. The assignment involves creating three classes: a deck, a player, and a dealer. The deck class will handle shuffling, dealing, and other related functions. The player class will manage player actions such as checking, folding, betting, and raising. The dealer class will determine the winner and keep track of bets. Students must ensure that each player starts with $1000 and bets $10 at the beginning of each hand, with additional betting opportunities after being dealt their cards and after each new card is revealed. The game continues until the user inputs 0 as the number of players.
Typology: Assignments
1 / 3
This page cannot be seen from the preview
Don't miss anything!
CSE294B Assignment # Professor Miller
CSE294B Assignment # 3.0% of course grade
This assignment is going to give you experience writing a program with classes and multiple files. You will build on Assignment #2 for this assignment.
You will add three classes into your program from Assignment #2. One of the classes will represent a deck and all functions that can be performed on it (such as shuffle, deal,
flop, river, turn, etc.). The second class will represent a player and all functions that can
be performed on or by a player (such as prompting for checking, folding, betting, etc.). The third class will represent the dealer, whose job is to determine the winner based on
the cards and keep track of all of the bets. The dealer class is going to contain the code
that keeps track of the flow of the game, but must call functions in the other classes.
We will not be performing the comparisons on the hands yet in this assignment, so you
still will not know which player actually wins. We will add in the ability for a player to fold, bet, or raise though. Each player will start with 1000 dollars and must bet 10
dollars at the beginning of the hand. There are four other times when players can bet:
after they are dealt their two cards, after the flop, after the turn, and after the river. A player can bet in 10 dollar increments, where the first player can only bet 10 dollars, but
then a subsequent player can bet either 10 dollars or raise to 20 dollars. If the next player raised to 20 dollars, the next player must bet 20 dollars or raise to 30 dollars. If
the player does not want to bet 20 dollars or raise to 30 dollars, he must fold. By the
time each betting round has concluded, all of the players that have not folded must have bet the same amount of money.
One additional requirement will be for your program to continue looping, prompting for how many players there are at the end of each hand. This should not stop until the user
types 0 as the number of players.
The letters used by the players are as follows: f = fold, z = check, b = bet, c = call, r =
raise. In parentheses, only the options available to the player are included, as a player
cannot do any of the options at any time. Here are the rules for what options the player has available:
A player can only check (z) or bet (b) if he already has the same amount of money in the pot as the player who has the most money in the pot.
A player can call (c) or raise (r) if he has less money in the pot than the player who has the most money in the pot. If he calls, he will put the same amount of money in the pot
as the player who has the most amount of money in the pot. If he raises, he will raise
for 10 dollars more than the amount in by the player who has the most money in the pot.
A player can fold (f) at any time, though he does not get any of his money back that he
has already put into the pot.
CSE294B Assignment # Professor Miller
Here is what the output of this program should be:
How many players are there? 4
Player 1 has bet 10 dollars. Player 2 has bet 10 dollars. Player 3 has bet 10 dollars. Player 4 has bet 10 dollars.
Player 1: Jack of Spades, 2 of Diamonds Player 2: 9 of Clubs, 6 of Clubs Player 3: Ace of Hearts, Ace of Diamonds Player 4: Ace of Clubs, Queen of Spades
Player 1: What would you like to do (f, z, b)? z Player 1 checks. Player 2: What would you like to do (f, z, b)? b Player 2 bets 10 dollars. Player 3: What would you like to do (f, c, r)? c Player 3 calls 10 dollars. Player 4: What would you like to do (f, c, r)? r Player 4 raises to 20 dollars. Player 1: What would you like to do (f, c, r)? f Player has folded Player 2: What would you like to do (f, c, r)? c Player 2 calls 20 dollars. Player 3: What would you like to do (f, c, r)? c Player 3 calls 20 dollars.
Flop: 3 of Diamonds, 5 of Clubs, 9 of Spades
Player 2: What would you like to do (f, z, b)? b Player 2 bets 10 dollars. Player 3: What would you like to do (f, c, r)? c Player 3 calls 10 dollars. Player 4: What would you like to do (f, c, r)? c Player 4 calls 10 dollars.
Turn: Ace of Spades
Player 2: What would you like to do (f, z, b)? z Player 2 checks. Player 3: What would you like to do (f, z, b)? z Player 3 checks. Player 4: What would you like to do (f, z, b)? z Player 4 checks.