Question: Im trying to build a python blacljack game using these rules There is at least one players playing the game and at most four. To

Im trying to build a python blacljack game using these rules

There is at least one players playing the game and at most four.

To start the game, a player can enter the number 1 through 4 to establish how many players there are.

All players start with $10,000.00 in their bank balance.

The dealer is always a computer AI and has unlimited funds.

The game is turn based.

All players have a name, including the computer AI. Players' names may be used as unique identifiers or additional information can be gathered.

Unique identifiers are used to serialize the game state to a file so that a player can have their bank balance upon return to the game.

The game is played with 8 decks of cards. The cards are typical cards with the ranks Ace, 2, 3, 4, 5, 6, 7, 8, 9, 10, Jack, Queen, King and the suits Clubs, Hearts, Spades, Diamonds. There are no jokers.

The value of the cards is the rank of the card except for Ace, Jack, Queen, and King. An Ace's value is either 1 or 11 depending on what is most advantageous to the hand in question. Jacks, Queens, and Kings have a value of 10.

Before playing, the cards must be shuffled and cut.

A cut card is placed randomly between the 60th and 80th card from the bottom of the deck.

The players play in the order their names are entered when the program starts. The dealer always goes last.

Once each player has had a turn in ascending order, the turn returns to the first player. (The process is a circular queue.)

The game is made up of many games. The players continue playing games of blackjack. At the end of every game, the game prompts the first player if they would like to play again. An answer of yes means the dealer will deal cards out to the same players who played previously. With multiple players, should one choose to leave then the first player must answer no to end the game and exit the program.

At the start of every game, before cards are dealt, each player must place a wager. A wager can be at least $1 and at most their bank balance.

A player may not wager more money than she has in her bank balance.

The cards are dealt one by one, starting with the first player and ending on the dealer.

The dealer's second card is kept hidden from the players; all other cards are dealt face up.

At the beginning of every turn, the game displays what cards the current player is holding and what face up card the dealer has showing.

Whenever a card is dealt, it is printed or shown to the players before taking any other action.

When it is the dealer's turn, the dealer must turn over (print or show) the face down card before taking any other action.

All bets pay out 2 to 1.

When a players turn begins, they have the option to double down.

A player may not surrender, split, or buy insurance.

The player may double down when her turn starts and never later.

The player may double down if and only if there is sufficient funds in her balance to double her wager.

A player is prompted to hit or stand unless they are busted or have 21. If they have busted or have 21 then a message is shown stating that they have busted or reached 21.

The dealer must hit on a hand that is less than 17. The dealer must stand on a hand that is 17 or greater.

The dealer only hits if there are players who are not busted.

No one wins or loses when there is a push.

A dealer does not place bets which means the dealer does not double down.

To summarize the order of game play operations:

If needed, cards are shuffled, cut, and a cut card is placed in a position between the 60th and 80th card from the bottom.

For each player, a wager is entered before the cards are dealt.

Cards are dealt one at a time starting with the first player, continuing through to the last player, and ending on the dealer. This is done twice such that each player and the dealer has two cards. The dealer's last card is kept face down until it is the dealer's turn.

For each player, begin their turn.

For each hand, offer to double down. For each double down wager, the player's wager is doubled.

While the player's hand is less than 21 or is not busted, offer the player to hit or stand. When the player hits deal an additional card. If the player stands, then the player's turn concludes.

The dealer plays last. If there exists a player who is not busted, then the dealer must play their hand according to the rules. Otherwise, the dealer stands.

For each player, determine if the player has won, lost, or pushed. Update all the players' balances to reflect the outcome of the game.

Requirements

The game must be written in Python 3. Limit your game to use only what is available in the Python Standard Library. Do not use additional Python modules that are outside of the Python Standard Library.

To run the game, the command must be ./blackjack.py. This means that the file blackjack.py must have a shebang and call the main game loop. This file contains only a call to the game's main loop which is defined in the blackjackgame package.

The game's logic must be defined in a package named blackjackgame. This means there must be a directory named blackjackgame which contains all the Python source code for the project. At a minimum, the following files must be included in the piggame package:

__init__.py

cards.py

game.py

player.py

The file __init__.py can be a very simple file which defines an __all__ variable for the package.

The file cards.py defines the playing cards and deck class along with any other supporting classes and functions needed to realize the game. The card class must be defined as a named tuple.

The file game.py defines the game loop and any other supporting classes and functions needed to realize the game. The game loop may be defined as a function or as a class.

The file player.py defines the human player class and the computer AI. Additional classes and functions related to the players may be included as well. The player class must be serializable to a Python Pickle such that their bank balance can be recalled when the game restarts.

The source file that is the executable file shall be named blackjack.py, and it shall be executable with a shebang at the top of the file.

The user interface of the game is text. There are no graphics (2D, 3D, sprites, etc.) in this game. You may use Unicode characters in your program.

If you would like to use audio effects or a soundtrack, you may however the program may only use what's available in the Python Standard Library.

The computer AI dealer must behave according to the rules specified.

Since this game is a terminal based game, use sleep or other similar mechanism to slow down the game to make the text appear on the screen slowly. Give the player an opportunity to read the text. A typewriter effect can be achieved with some creative use time.sleep with values less than 1 second.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!