0% found this document useful (0 votes)
7 views1 page

Lab 3

Lab 3 for CS321L involves modifying a Blackjack game to address specific issues, including making all fields private and preventing players from betting more money than they have. The game follows standard Blackjack rules with a few variations, such as using a single deck and specific dealer behavior. Students are required to submit the modified code and a text file with the output from three rounds of gameplay.

Uploaded by

mbielawski21
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views1 page

Lab 3

Lab 3 for CS321L involves modifying a Blackjack game to address specific issues, including making all fields private and preventing players from betting more money than they have. The game follows standard Blackjack rules with a few variations, such as using a single deck and specific dealer behavior. Students are required to submit the modified code and a text file with the output from three rounds of gameplay.

Uploaded by

mbielawski21
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Lab 3

CS321L Winter 2023, Professor Christopher Diggins

Overview
This lab involves modifying a Blackjack game created using classes. See:
https://en.wikipedia.org/wiki/Blackjack for the rules of Blackjack.

The initial code provided can be found at: https://github.com/cdiggins/cs321/tree/main/code-


examples/Blackjack.

The object of the game is to win money by creating card totals higher than those of the dealer's hand
but not exceeding 21, or by stopping at a total in the hope that the dealer will bust. On their turn,
players choose to "hit" (take a card) or "stand" (end their turn and stop without taking a card).

Face cards are worth 10, and Aces are worth either 1 or 11, depending on what is more advantageous
for the hand evaluation. A hand evaluated with an Ace worth 11 is called a “soft” hand.

In our version of Blackjack:

• We will use a single deck of cards.


• Players cannot split.
• Dealer stands on a soft 17 or higher, or hits automatically.

The code provided has a few problems:

• All fields are public (they should all be private)


• The player can bet more money than they have.

Tasks:

• Make all fields private.


• Add new functions, constructors, and/or properties to allow the functionality to work as before.
• Prevent the user from betting more money than they have.

Submission:

• The project file and source code of the game.


• Play three rounds of the game. Put the output in a text-file: output.txt.

Grading

• 2 points: all fields are private, and the code still works.
• 1 point: user can’t bet more money than they have.
• 1 point: code follows the coding guidelines and is easy to read and understand.

You might also like