SlideShare uma empresa Scribd logo
1 de 6
TO Buy the Tutorial Visit Our Website

BlackJack Table
Specification: Include a brief description of what the program accomplishes,
including its input, key processes, and output.
There is always a dealer in the game. At the start of the game, the dealer’s first
card will not be shown or displayed. The second card will be displayed. The
dealer may draw additional cards. The dealer must use a random-number
generator to determine the maximum number of cards the dealer will draw--a
value between 0 and 3. In other words, the dealer is a computer player. The
dealer does not show all the cards or the total until all the players have either
gone bust (over 21) or hold (no more cards drawn). There must be at least one
other player (you) and up to a maximum of four other players (all played by
you).
. On a player’s turn, that player may either draw a card or hold. Once a player
holds, he or she should not be asked to draw another card during this game.
All the cards for each player, including the first card dealt, are displayed, along
with the suit symbol: spades ♠, clubs ♣, hearts ♥, or diamonds ♦. Each game
will start with a new, 52-card deck, which is modeled on a real deck of cards.
. The card deck has 52 cards with no jokers.
The card deck is represented by a two-dimensional array of data-type character,
where the first dimension represents the suit and the second dimension
represents the card in the suit, such as the following. i. char CardDeck[4][13];
At the start of each game, each element of the two-dimensional array is
initialized to a value of " ", or the "space" character. The deck has four suits,
represented by the following dimension indices.
.
i. ii. iii. Each suit has 13 cards: 2, 3, 4, 5, 6, 7, 8,9 ,10, jack, queen, king, and
ace. Each card in a suit is represented by the following dimension indices.
. 2 card
i. 3 card ii. 4 card iii. 5 card iv. 6 card v. 7 card vi. 8 card vii. 9 card viii. 10 card
ix. jack x. queen xi. king xii. ace All the number cards are worth their face value
(i.e., a 3 of diamonds is worth 3). All face cards are worth 10. An ace is worth
either 1 or 11. Your final-score calculation must be able to handle this correctly
for both the dealer and each player. A random-number generator must be used
to select the suit and the card in the suit.
. Once a card and suit are selected, the program should check if the value of that
array element is a "space."
If the array set the element equal to an integer, identifying the dealer or the
player. 1 2 3 4 If the array element ! = "space," then the random-number and
card-checking process should repeat until a "card" or an array element is
selected that Once a card is drawn during a game, it cannot be drawn again.
When the program first starts, it should prompt the user, asking if he or she
wants to play a game of Blackjack or exit the program. If the user inputs to play
the game, the next decision should be 1, 2, 3, or 4 players. At the start of the
game, the dealer and each player should be dealt two cards. One of the dealer’s
card's value and suit should not be displayed. The number of cards that the
dealer will draw during a game should be determined by a random-number
generator that will return a value of 0, 1, 2, or 3 cards to be drawn. Each player
may then draw a card or hold. If, after drawing a card, any player or the dealer
goes over a score of 21, he or she is not allowed to draw any more cards during
the game. Once a player holds, he or she should not be asked to draw a card
again during the game. The game continues until one of the following
conditions occur:
. all players have declared hold;
all players and the dealer have gone over 21; a maximum of five cards total are
held by any player at the end of a round of card draws; or any combination of
the above. The display should show each player’s (and the dealer’s) hand and
update the display after each round of card draws.
spades ♠, clubs ♣, hearts ♥, and diamonds ♦
Example
Card 1
Card 2
Card 3
Card 4 Card 5
Dealer:
?
10♦
Player 1:
A♣
2♠
Player 2:
J♣
Q♥
Player 3:
3♦
8♣
At the end of a game, the display should be repeated, with the addition of win or
lose and an updated balance.
Example
Card 1
Card 2
Card 3
Card 4
Card 5
Total
Stats
Dealer:
J♦
10♦
20
Lose
Player 1:
K♣
2♠
5♥
1♦
5♦
23
Lose
Player 2:
J♣
Q♥
20
Lose
Player 3:
3♦
8♣
K♦
21
Win!
The program should then ask each player if he or she wants to play again or
leave the game. The game continues with a new round, as long as there is one
player remaining. If there are no remaining players, the program should exit.
Lose
Player 2:
J♣
Q♥
20
Lose
Player 3:
3♦
8♣
K♦
21
Win!
The program should then ask each player if he or she wants to play again or
leave the game. The game continues with a new round, as long as there is one
player remaining. If there are no remaining players, the program should exit.

Mais conteúdo relacionado

Mais procurados

Ch11 Search & Sort
Ch11 Search & SortCh11 Search & Sort
Ch11 Search & Sort
leminhvuong
 
Probability Deck of Cards
Probability Deck of CardsProbability Deck of Cards
Probability Deck of Cards
Sharlaine Ruth
 
Procedimiento del guego...............
Procedimiento del guego...............Procedimiento del guego...............
Procedimiento del guego...............
jonatanputo
 
Fault treepoker 2010-07-08_release
Fault treepoker 2010-07-08_releaseFault treepoker 2010-07-08_release
Fault treepoker 2010-07-08_release
William L. McGill
 
Fault treepoker 2010-07-31_release
Fault treepoker 2010-07-31_releaseFault treepoker 2010-07-31_release
Fault treepoker 2010-07-31_release
William L. McGill
 

Mais procurados (20)

Ch11 Search & Sort
Ch11 Search & SortCh11 Search & Sort
Ch11 Search & Sort
 
2nd National ArithmetEQ Challenge Rules
2nd National ArithmetEQ Challenge Rules2nd National ArithmetEQ Challenge Rules
2nd National ArithmetEQ Challenge Rules
 
Probability Deck of Cards
Probability Deck of CardsProbability Deck of Cards
Probability Deck of Cards
 
Probability of card
Probability of  cardProbability of  card
Probability of card
 
Cards probability
Cards probabilityCards probability
Cards probability
 
Dominate paola galvisss
Dominate paola galvisssDominate paola galvisss
Dominate paola galvisss
 
Probability of cards
Probability of cardsProbability of cards
Probability of cards
 
Elements
ElementsElements
Elements
 
Procedimiento del guego...............
Procedimiento del guego...............Procedimiento del guego...............
Procedimiento del guego...............
 
Fault treepoker 2010-07-08_release
Fault treepoker 2010-07-08_releaseFault treepoker 2010-07-08_release
Fault treepoker 2010-07-08_release
 
Outnumber - Numbers card game Rulebook
Outnumber - Numbers card game RulebookOutnumber - Numbers card game Rulebook
Outnumber - Numbers card game Rulebook
 
Outnumber rulebook
Outnumber rulebookOutnumber rulebook
Outnumber rulebook
 
Set 4 quiz of zero-sum games
Set 4   quiz of zero-sum gamesSet 4   quiz of zero-sum games
Set 4 quiz of zero-sum games
 
Fault treepoker 2010-07-31_release
Fault treepoker 2010-07-31_releaseFault treepoker 2010-07-31_release
Fault treepoker 2010-07-31_release
 
Taking a Gamble with Functional Domain Modeling
Taking a Gamble with Functional Domain ModelingTaking a Gamble with Functional Domain Modeling
Taking a Gamble with Functional Domain Modeling
 
The Bingo Glossary
The Bingo GlossaryThe Bingo Glossary
The Bingo Glossary
 
Battle Cards
Battle CardsBattle Cards
Battle Cards
 
Kelly Quant (intro)
Kelly Quant (intro)Kelly Quant (intro)
Kelly Quant (intro)
 
Game Theory
Game TheoryGame Theory
Game Theory
 
Intellectual playing cards - Not for everyone
Intellectual playing cards - Not for everyoneIntellectual playing cards - Not for everyone
Intellectual playing cards - Not for everyone
 

Semelhante a Comp 220 i lab 1 two dimensional arrays lab report and source code

How to Classic Indian Rummy
How to Classic Indian RummyHow to Classic Indian Rummy
How to Classic Indian Rummy
Gauravwwww
 
Castleofdoom
CastleofdoomCastleofdoom
Castleofdoom
kdrapala
 

Semelhante a Comp 220 i lab 1 two dimensional arrays lab report and source code (17)

Deccan rummy – how to play deals rummy
Deccan rummy – how to play deals rummy Deccan rummy – how to play deals rummy
Deccan rummy – how to play deals rummy
 
Deccan rummy – how to play points rummy?
Deccan rummy – how to play points rummy?Deccan rummy – how to play points rummy?
Deccan rummy – how to play points rummy?
 
Deccan rummy – how to play deals rummy?
Deccan rummy – how to play deals rummy?Deccan rummy – how to play deals rummy?
Deccan rummy – how to play deals rummy?
 
Deccan rummy – how to play pool rummy?
Deccan rummy – how to play pool rummy?Deccan rummy – how to play pool rummy?
Deccan rummy – how to play pool rummy?
 
How to Classic Indian Rummy
How to Classic Indian RummyHow to Classic Indian Rummy
How to Classic Indian Rummy
 
Deccan rummy – how to play pool rummy
Deccan rummy – how to play pool rummy Deccan rummy – how to play pool rummy
Deccan rummy – how to play pool rummy
 
TRADE SECRETS
TRADE SECRETSTRADE SECRETS
TRADE SECRETS
 
How to play Rummy
How to play RummyHow to play Rummy
How to play Rummy
 
Castleofdoom
CastleofdoomCastleofdoom
Castleofdoom
 
Learn to play cou
Learn to play couLearn to play cou
Learn to play cou
 
How To Play 500 Rummy
How To Play 500 RummyHow To Play 500 Rummy
How To Play 500 Rummy
 
How to play poker
How to play poker How to play poker
How to play poker
 
$100 underground e book - How to be a champion in online poker games
$100 underground e book - How to be a champion in online poker games$100 underground e book - How to be a champion in online poker games
$100 underground e book - How to be a champion in online poker games
 
Honor Among Thieves
Honor Among ThievesHonor Among Thieves
Honor Among Thieves
 
Baccarat
BaccaratBaccarat
Baccarat
 
Rebel scrum prototype_1214
Rebel scrum prototype_1214Rebel scrum prototype_1214
Rebel scrum prototype_1214
 
National ArithmetEQ Challenge Rules 2010
National ArithmetEQ Challenge Rules 2010National ArithmetEQ Challenge Rules 2010
National ArithmetEQ Challenge Rules 2010
 

Último

An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
SanaAli374401
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
Chris Hunter
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 

Último (20)

Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 

Comp 220 i lab 1 two dimensional arrays lab report and source code

  • 1. TO Buy the Tutorial Visit Our Website BlackJack Table Specification: Include a brief description of what the program accomplishes, including its input, key processes, and output. There is always a dealer in the game. At the start of the game, the dealer’s first card will not be shown or displayed. The second card will be displayed. The dealer may draw additional cards. The dealer must use a random-number generator to determine the maximum number of cards the dealer will draw--a value between 0 and 3. In other words, the dealer is a computer player. The dealer does not show all the cards or the total until all the players have either gone bust (over 21) or hold (no more cards drawn). There must be at least one other player (you) and up to a maximum of four other players (all played by you). . On a player’s turn, that player may either draw a card or hold. Once a player holds, he or she should not be asked to draw another card during this game. All the cards for each player, including the first card dealt, are displayed, along with the suit symbol: spades ♠, clubs ♣, hearts ♥, or diamonds ♦. Each game will start with a new, 52-card deck, which is modeled on a real deck of cards. . The card deck has 52 cards with no jokers. The card deck is represented by a two-dimensional array of data-type character, where the first dimension represents the suit and the second dimension represents the card in the suit, such as the following. i. char CardDeck[4][13];
  • 2. At the start of each game, each element of the two-dimensional array is initialized to a value of " ", or the "space" character. The deck has four suits, represented by the following dimension indices. . i. ii. iii. Each suit has 13 cards: 2, 3, 4, 5, 6, 7, 8,9 ,10, jack, queen, king, and ace. Each card in a suit is represented by the following dimension indices. . 2 card i. 3 card ii. 4 card iii. 5 card iv. 6 card v. 7 card vi. 8 card vii. 9 card viii. 10 card ix. jack x. queen xi. king xii. ace All the number cards are worth their face value (i.e., a 3 of diamonds is worth 3). All face cards are worth 10. An ace is worth either 1 or 11. Your final-score calculation must be able to handle this correctly for both the dealer and each player. A random-number generator must be used to select the suit and the card in the suit. . Once a card and suit are selected, the program should check if the value of that array element is a "space." If the array set the element equal to an integer, identifying the dealer or the player. 1 2 3 4 If the array element ! = "space," then the random-number and card-checking process should repeat until a "card" or an array element is selected that Once a card is drawn during a game, it cannot be drawn again. When the program first starts, it should prompt the user, asking if he or she wants to play a game of Blackjack or exit the program. If the user inputs to play the game, the next decision should be 1, 2, 3, or 4 players. At the start of the game, the dealer and each player should be dealt two cards. One of the dealer’s card's value and suit should not be displayed. The number of cards that the dealer will draw during a game should be determined by a random-number generator that will return a value of 0, 1, 2, or 3 cards to be drawn. Each player may then draw a card or hold. If, after drawing a card, any player or the dealer goes over a score of 21, he or she is not allowed to draw any more cards during the game. Once a player holds, he or she should not be asked to draw a card again during the game. The game continues until one of the following conditions occur: . all players have declared hold;
  • 3. all players and the dealer have gone over 21; a maximum of five cards total are held by any player at the end of a round of card draws; or any combination of the above. The display should show each player’s (and the dealer’s) hand and update the display after each round of card draws. spades ♠, clubs ♣, hearts ♥, and diamonds ♦ Example Card 1 Card 2 Card 3 Card 4 Card 5 Dealer: ? 10♦ Player 1: A♣ 2♠ Player 2: J♣ Q♥ Player 3: 3♦ 8♣
  • 4. At the end of a game, the display should be repeated, with the addition of win or lose and an updated balance. Example Card 1 Card 2 Card 3 Card 4 Card 5 Total Stats Dealer: J♦ 10♦ 20 Lose Player 1: K♣ 2♠ 5♥ 1♦ 5♦ 23
  • 5. Lose Player 2: J♣ Q♥ 20 Lose Player 3: 3♦ 8♣ K♦ 21 Win! The program should then ask each player if he or she wants to play again or leave the game. The game continues with a new round, as long as there is one player remaining. If there are no remaining players, the program should exit.
  • 6. Lose Player 2: J♣ Q♥ 20 Lose Player 3: 3♦ 8♣ K♦ 21 Win! The program should then ask each player if he or she wants to play again or leave the game. The game continues with a new round, as long as there is one player remaining. If there are no remaining players, the program should exit.