Crazy Eights, Akira's Version
The mission of this assignment is to realize a "Crazy Eights" card game using a standard 52-card
deck. Read the specified link (wikipedia) or watch this video (and others too) to understand how
this simple game works out. In this assignment, you will be playing with other 3 people whose
card turns are automatically generated according to the next rules:
● find the same number of any suit
● find the same suit
● use any eight and declare the suit of the most occurring suit in hand (e.g., select H if HHHCCDS
in hand)
● draw from the deck until finding any of the above
You need to implement the card selection in this order. Each player is given 6 cards at the
beginning of the game. You are the first player, and anyone who used up all cards will win.
Game also ends when all cards in the stockpile are used. You should check all the potential
input errors. The first card in the pile may be a crazy eight, in which case use it as a selection
condition of suit or reshuffle the pile to choose another non crazy eight card (choice is up to
you).
You must display all kinds of transactions happening in the progress of the game. At your turn,
typing "?" will show hands of others (cheating option). The next session shows an example
game sessions. You must adapt this output format as much as possible -- point will be
deducted if yours is deviated too much.
Pile has S10 <--- your turn
(a) C3 (b) H3 (c) C8 (d) S3 (e) HK (f) DQ (g) draw
Which one to play? d
Pile has S3
Player 1 chose H8
Player 1 declared suite C
Pile has C*
Player 2 chose CJ
Pile has CJ
Player 3 chose CK
Pile has CK <--- your turn
(a) C3 (b) H3 (c) C8 (d) DQ (e) HK (f) draw
Which one to play? a
Pile has C3
Player 1 chose CQ
Pile has CQ
Player 2 chose D8
Player 2 declared suite S
Pile has S*
Player 3 drawing...
Player 3 chose S9
Pile has S9 <--- your turn
(a) HK (b) H3 (c) C8 (d) DQ (e) draw
Which one to play? ?
Player 1 (a) D9 (b) H4 (c) C4 (d) HA
Player 2 (a) S7 (b) HJ (c) SA (d) SK
Player 3 (a) H5 (b) H6 (c) H2 (d) DA (e) H10
Which one to play? e
(a) HK (b) H3 (c) C8 (d) DQ (e) D6 (f) draw
Which one to play? f
(a) HK (b) H3 (c) C8 (d) DQ (e) D6 (f) S5 (g) draw
Which one to play? f
Pile has S5
Player 1 drawing...
Player 1 chose S6
Pile has S6
Player 2 chose S7
Pile has S7
Player 3 drawing...
Player 3 chose D7
Pile has D7 <--- your turn
(a) HK (b) H3 (c) C8 (d) DQ (e) D6 (f) draw
Which one to play? d
Pile has DQ
Player 1 chose D9
Pile has D9
Player 2 drawing...
Player 2 drawing...
Player 2 drawing...
Player 2 chose C9
Pile has C9
Player 3 drawing...
Player 3 drawing...
Player 3 drawing...
Player 3 chose S8
Player 3 declared suite H
Pile has H* <--- your turn
(a) HK (b) H3 (c) C8 (d) D6 (e) draw
Which one to play? a
Pile has HK
Player 1 chose HA
Pile has HA
Player 2 chose HJ
Pile has HJ
Player 3 chose H5
Pile has H5 <--- your turn
(a) D6 (b) H3 (c) C8 (d) draw
Which one to play? b
Pile has H3
Player 1 chose H4
Pile has H4
Player 2 chose HQ
Pile has HQ
Player 3 chose H6
Pile has H6 <--- your turn
(a) D6 (b) C8 (c) draw
Which one to play? b
Which suit you want? D
Pile has D*
Player 1 drawing...
Player 1 chose D5
Pile has D5
Player 2 drawing...
Player 2 drawing...
Player 2 chose DK
Pile has DK
Player 3 chose D3
Pile has D3 <--- your turn
(a) D6 (b) draw
Which one to play? a
You won!
[ Final card distributions ]
Player 0
Player 1 (a) C4
Player 2 (a) SK (b) C2 (c) SA (d) S4
Player 3 (a) H10 (b) SJ (c) H2 (d) DA
In the game, Player 0 represents you and Player 1 through 3 are (machine-implemented) family
member competitors. Review the video-posted implementation hint carefully to implement this
assignment. Start early as one weekend may not be enough for the completion of your work,
though the total amount of coding is not more than 180 lines.
版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。