~/$ ./part1 2♣ 3♣ 4♣ 5♣ 6♣ 7♣ 8♣ 9♣ 10♣ J♣ Q♣ K♣ A♣ 2♦ 3♦ ⋮A part 1 solution prints out a list of all 52 cards as shown to the right. Note that a correct solution must store representations of the 52 cards in an array, and then print the output. Otherwise its use in working towards the remaining steps of the project is limited.
~/$ ./part3 Player Dealer 2♠ A♦ 6♦ A♣ Player Dealer 2♠ A♦ 6♦ A♣ J♥ 3♣ Player Dealer 2♠ A♦ 6♦ A♣ J♥ 3♣ 8♣ 3♥ Player Dealer 2♠ A♦ 6♦ A♣ J♥ 3♣ 8♣ 3♥ 4♥ 6♥A correct part 3 solution will simulate dealing cards to a "Player" and a "Dealer" in the following order: deal two cards to "Player", two cards to "Dealer, then display (as shown on right). Then three rounds of dealing one card each to "Player" and "Dealer", then displaying the hands (once again as shown on right).
system("clear"); to clear the
terminal window, so that only the current state of the game is
showing at any given time.
Below is an example of how a game might play out. Your output
and the way you get input from the user should match what's
shown here.
$ ./part4 Player Dealer A♠ J♠ 2♣ Q♠ Player: (h)it or (s)tand? h |
Player Dealer A♠ J♠ 2♣ Q♠ 7♦ Dealer: (h)it or (s)tand? s |
Player Dealer A♠ J♠ 2♣ Q♠ 7♦ Player: (h)it or (s)tand? s |
Player Dealer A♠ J♠ 2♣ Q♠ 7♦ Dealer: (h)it or (s)tand? h |
Player Dealer A♠ J♠ 2♣ Q♠ 7♦ 4♦ Player: (h)it or (s)tand? s |
Player Dealer A♠ J♠ 2♣ Q♠ 7♦ 4♦ Dealer: (h)it or (s)tand? h |
Player Dealer
A♠ J♠
2♣ Q♠
7♦ 4♦
10♥
|
$ ./part5Player Dealer 9♣ 6♦ 8♣ 10♣ Player: 17, Dealer: 16 Player: (h)it or (s)tand? s |
Player Dealer 9♣ 6♦ 8♣ 10♣ Player: 17, Dealer: 16 Dealer: (h)it or (s)tand? h |
Player Dealer
9♣ 6♦
8♣ 10♣
3♦
Player: 17, Dealer: 19
Player: (h)it or (s)tand? h
|
Player Dealer 9♣ 6♦ 8♣ 10♣ A♣ 3♦ Player: 18, Dealer: 19 Dealer: (h)it or (s)tand? s |
Player Dealer 9♣ 6♦ 8♣ 10♣ A♣ 3♦ Player: 18, Dealer: 19 Player: (h)it or (s)tand? h |
Player Dealer 9♣ 6♦ 8♣ 10♣ A♣ 3♦ 7♠ Player: 25, Dealer: 19 Dealer: (h)it or (s)tand? s |
Player Dealer 9♣ 6♦ 8♣ 10♣ A♣ 3♦ 7♠ Player: 25, Dealer: 19 |
sleep(2) (this will require
#include <unistd.h>)
to pause the game for two seconds so that the user has a
chance to see what the Dealer is doing before being
presented with the updated screen.
$ ./part6Player Dealer 3♣ 3♦ 4♥ 4♦ Player: 7, Dealer: 7 Player: (h)it or (s)tand? h |
Player Dealer 3♣ 3♦ 4♥ 4♦ 8♥ Player: 15, Dealer: 7 Dealer: (h)it or (s)tand? h |
Player Dealer 3♣ 3♦ 4♥ 4♦ 8♥ 9♦ Player: 15, Dealer: 16 Player: (h)it or (s)tand? h |
Player Dealer 3♣ 3♦ 4♥ 4♦ 8♥ 9♦ 8♣ Player: 23, Dealer: 16 |
$ ./part6 Player Dealer Q♣ 10♠ Q♠ 10♣ Player: 20, Dealer: 20 Player: (h)it or (s)tand? s |
Player Dealer Q♣ 10♠ Q♠ 10♣ Player: 20, Dealer: 20 Dealer: (h)it or (s)tand? s |
Player Dealer Q♣ 10♠ Q♠ 10♣ Player: 20, Dealer: 20 |
$ ./part6Player Dealer K♥ 4♠ A♥ 5♣ Player: 21, Dealer: 9 Player: (h)it or (s)tand? s |
Player Dealer K♥ 4♠ A♥ 5♣ Player: 21, Dealer: 9 Dealer: (h)it or (s)tand? h |
Player Dealer
K♥ 4♠
A♥ 5♣
3♦
Player: 21, Dealer: 12
Player: (h)it or (s)tand? s
|
Player Dealer
K♥ 4♠
A♥ 5♣
3♦
Player: 21, Dealer: 12
Dealer: (h)it or (s)tand? h
|
Player Dealer
K♥ 4♠
A♥ 5♣
3♦
2♥
Player: 21, Dealer: 14
Player: (h)it or (s)tand? s
|
Player Dealer
K♥ 4♠
A♥ 5♣
3♦
2♥
Player: 21, Dealer: 14
Dealer: (h)it or (s)tand? h
|
Player Dealer
K♥ 4♠
A♥ 5♣
3♦
2♥
7♥
Player: 21, Dealer: 21
|
** until the end of the game. This way, the
Player has some uncertaintly about what to do.
submit proj02 *.cppThis will submit all C++ files in that directory, with the goal of pushing the C++ file for each portion of the project. The syntax of the command is submit Project_Name (in this case proj02) and the files you wish to submit. Feel free to include any additional files you believe may be beneficial. You may submit files at any time, the last submission will be used for grading.