,,C++ STL。
Objective
This lab is intended to combine and extend your use of C++ language features from the previous labs, and to give you more experience programming with the C++ STL. To do this, you will extend your C++ programs from the previous labs to (1) add a new game (Seven Card Stud) in addition to the Five Card Draw game from lab 3 (which you will enhance in this lab), (2) manage different numbers and kinds of player turns in the two games, (3) find the highest ranking combination of cards for each player in each of those games and rank the players accordingly, and (4) add features to both games so that players win or lose chips in each round of play.
For extra credit, you may optionally implement (5) an additional game (Texas Hold ‘Em).
In this lab, you are again encouraged to re-use and modify code from your previous lab solutions - if you choose do this, please put a completely new copy of any header and source files from your previous lab(s) in the new lab project directory you create. This can avoid some potential for error or confusion within Visual Studio, and also ensures you have a backup copy that you could go back to if a modification you try doesn’t pan out.
In this lab you may work individually, or in teams of 2 or 3 (but not more) people. Team projects may use any of the team members’ previous code in the team’s solution.
Assignment
Readings
Please make sure to review and apply all of the CSE 332 Programming Guidelines as you implement your solution.
Program Design and Implementation
Note: the details of this assignment are again intentionally somewhat under-specified, leaving you some room to choose what you think is the best way to implement them, as long as what you do is reasonable and you explain your design decisions in comments in the code and in your Readme.txt file.
For this lab assignment, you are especially encouraged to think creatively about how to structure (or restructure) the turn and round methods (including the before, during, and after phases of each): some potentially useful ideas may include having more turns per round, introducing addtional member variables to indicate the different stages of play in each game, or interspersing betting phases with play phases in different ways.
Step 1
Open up Visual Studio, and create a new Win32 Console Application Visual C++ project for lab 4. Copy the files you wish to re-use from your lab 3 solution (or solutions if a team project) into the source/header files directory for your lab 4 project and add them to the project.
Step 2
Please add an unsigned integer member variable to your Player class to keep track of how many chips the player has. When a player is constructed this variable should be initialized with 20. When players quit or re-join either game, this value (along with their wins and losses) should be stored to or restored from a file (as was done for other information in the previous lab) for that player.
As each player plays they will win or lose chips during betting phases that will occur at different points in each game, and if a player’s chip count is ever 0 after a round the player should be prompted (and required) either to reset their chip count to 20 and keep playing, or to quit the game. If a player with 0 chips quits the game and then tries to rejoin the game, they should be required either to reset their chip count to 20 and keep playing, or not rejoin the game after all.
Step 3
Please update your FiveCardDraw class so that:
-
Before each round an ante of one chip should be deducted from each player’s chip count and added to a common pot of chips that will go to the winner of the round.
-
During each of two betting phases in each round (one phase before cards are drawn and one after cards are drawn) the program should rotate among the remaining players, prompt each player for which action to take (and how many chips to bet or raise for those actions), deduct the chips each player bets, calls, or raises from their chip total, and should also record the cumulative amount they have bet during that phase (to be able to know how many chips are needed to call any previous bets or raises that‾†㱡⽹㹲ഠ੨†㱥⽴㹯ഠ੦†㱴㸠൮⁸⁴†⁰㱬㹹†⁵†䙡䍭䐠⁰Ⱐ⁴†‱′ †㱥⼠㸠൰੬⁹㰠⽤㹳ഠ⁴†㱵㹮൧ਠ†⁰㱡㹥†䙴䍯䑲⁴††㕡††ⱳ†⁴䍡⁵⁴⁴⁰†㝮⁹††㕩䙧†††⁰⁴⁴⠠⁴⁴†⁴⥡⁹䍰††⁵†㕮ⱬ☠㬠††⁵⁵⁵⡳⤬†㱡⽩㸠൩੮†⁴㰠⽲㹮ਠ㱷⽩㸠൮੯㰠㍵㵥≲㕧≡㹴⁴㕯㰠⽣㍬㹬ബਠ㱢㹴††䝰ⁱ††⡲ㅯ⥵♤㭶䍯♩㭴†⁴†⁴⁰Ɐ†††⁴䍮††㬠⡵㈠⥭⁴†⁴⠬⥩⁴†††††⁰⸠䥮⁴†⁰††⁴⁴⁴⡥ⵡ†⸠†⁴†⥦⸠㱴⽨㸠൰੨㱡㹥䤠
⁹†Ɐ⁴††⁴⁴ⵥ㱲⽤㹤ഠੴ㱯㍴㵲≥㙮≧㸠㙲㰬⼠㍨㹥൩ੲ㰠㹩䉮†ⱥ† †⁴†⁵††⁴⡲⁴♰㬠⁴⁴⁵†⤠⁴†䵡⁰䥬⁴††⁹†⁴Ⱐ⁴†⁴†Ⱐ⁷
†††䵲㱡⽹㹲൳ਠ㱬㍳㵯≵ⵡ㝲≥㸠㝡㱳⽥㌠㹢൹ਠ㱯㹥‾†† ‾⡁⥤†⁵†⁴⁰♳㬠Ⱳ††⁵⁴††† ⸭‴䤢⁓‴䴾⸊⁐††⡥ⱴ†⥭⁷†Ⱐ⁴⁶⸠㱭⽵㹨ഠ㱯㍭㵦≵ⵯ㡮≡㹬㡳㰠⽰㍳㹳൩㱬㸠䥵††䵳⁰ⱴ⁴†⡳⁴⁴⠠㐮⤬†⁷Ⱐ††☠㭸⁰†⁴⁰⁹⁴⡵††⤠†⁴䈠䴯⸾⁰ⱡ⁴⡥⥓⡡⥤⁓‼ †⹅㱡⽣㸠൲੯㱵㍤†㵯≵ⵯ㥮≳㹩㤠㱭⽵㍴㹩൰੬㱥㹴††♰㬠‼Ⱐ†Ⰽ †䵯†⁰⡬※ⱷ⁴†⁹⥥Ɑ†㩴㱩⽬㹴൨㰠㹮ੳ††㱴㸠䍲⁰㑡†㭮㱤⼮㹨ਠ⁴㰠㸠䍴ⁱ⡥Ⱳ䴠Ⱳ⁄†⁰⁵⁴⤠⁴†㭰㱦⽯㹯൷ੳ›†㱬㹦ⵣ⁴⁴ⁱ⁵ⵥ㭯䍵⁵⡬⥦䙣†††㱡⽹㹳ദੲ㱳⽱㸻ഠ੨㱡㉤㵢≵䕴䌠≥㸠䕦䍯㱲⽤㈠㹩൮ਠ㱴㹥†
⁵⡯ⁱ䡵☼㬠䔠⤠⸼㰯‾⼍㸊ഠਠ‼‾Ⱐ†⁉†㱣⽥㹤൯㱮㍣㵳∠ㅨづ≮㸠ㅡっ㱥⼠㍰㸠ൣ㱲㸮†‼䠠䕬‾⸠‼䵰††††䙰䍥䑨†䌠⁴ⱥ† ‼†‾†⁴ ⠀ ⤀ ⸀ 䘀 Ⰰ Ⰰ Ⰰ ⠀⤀ Ⰰ ⸀ ⸀㰀⼀㸀ഀ㰀㸀 䠀䔀 㨀㰀⼀㸀ഀ㰀㸀ഀ 㰀㸀ഀ 㰀㸀䔀 Ⰰ ⸀㰀⼀㸀ഀ 㰀⼀㸀ഀ 㰀㸀ഀ 㰀㸀䔀 ☀㬀 ☀㬀 ⸀ ☀㬀 ☀㬀 ⸀ 䐀 ☀㬀 Ⰰ ☀㬀 Ⰰ Ⰰ ☀㬀 ⠀☀㬀☀㬀⤀⸀㰀⼀㸀ഀ 㰀⼀㸀ഀ 㰀㸀ഀ 㰀㸀䤀 ⸀㰀⼀㸀ഀ 㰀⼀㸀ഀ 㰀㸀ഀ 㰀㸀䤀 ⠀ ☀㬀☀㬀⤀ ⸀㰀⼀㸀ഀ 㰀⼀㸀ഀ 㰀㸀ഀ 㰀㸀䤀 ⠀ ☀㬀☀㬀 ☀㬀☀㬀 ⤀ ⸀㰀⼀㸀ഀ 㰀⼀㸀ഀ 㰀㸀ഀ 㰀㸀 䘀䌀䐀 Ⰰ ⸀㰀⼀㸀ഀ 㰀⼀㸀ഀ 㰀㸀ഀ 㰀㸀 䘀䌀䐀 䌀 Ⰰ 䠀䔀 㔀 㜀 ㈀ 㔀 ⸀ 䘀 ⠀ ⤀ 䌀 㔀 Ⰰ ⠀⤀ ⸀㰀⼀㸀ഀ 㰀⼀㸀ഀ㰀⼀㸀ഀ㰀㌀ 㴀∀ⴀ∀㸀 㰀⼀㌀㸀ഀ㰀㸀 䜀 ☀㬀䠀䔀☀㬀 Ⰰ 䠀䔀 ⸀㰀⼀㸀