CSE 332 Lab 4: Multiple Card Games

Due by Sunday April 26 at 11:59 pm
Final grade percentage: 18 percent

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:

    Part I - Readings:

  1. Please make sure to review and apply all of the CSE 332 Programming Guidelines as you implement your solution.

    Part II - 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.

  2. 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.
  3. 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.

  4. Please update your FiveCardDraw class so that:
  5. Please add a SevenCardStud class. Make sure that it implements all of the common features of your FiveCardDraw solution, and in fact one good approach is to move as much common functionality as possible up into (possibly private) methods of the Game class or of an intermediate class (e.g., PokerGame which is derived from Game) . For example collecting antes, saving and restoring players, handling the cases where a player runs out of chips during a round, announcing the winner(s) at the end of each round, etc. should work essentially the same in all games.

    Please implement the following features in your SevenCardStud class:

  6. Please update your Game class and your main function so that (1) "SevenCardStud" is recognized as a valid name of a game, and when it is provided should result in a SevenCardStud game being created and played; and (2) after any game is finished the program should stop (and destroy) the previous game and then prompt the user whether to play a new game or quit the program. If the user chooses to play a new game the program should prompt for the name of the game and the names of the players (re-prompting for whether to quit or play again etc. as needed if an invalid game name is given).

    If at any point the program encounters an error that will not allow it to continue, it should generate an error message and return an approprate non-zero error code.

  7. Build your project, and fix any errors or warnings that occur. Please be sure to note all of the different kinds of errors or warnings you ran into (though you don't have to list every instance of each kind) in your ReadMe.txt file. If you were fortunate enough not to run into any errors or warnings, please note that instead, where you would have listed errors or warnings in your ReadMe.txt file.

  8. Open up a Windows console (terminal) window and change to the directory where your program's executable file was created by Visual Studio, and run the executable program through a series of trials that test it with good coverage of cases involving both well formed and badly formed inputs. In your ReadMe.txt file please document which cases you ran (i.e., what the command lines were) and summarize what your program did and whether that is correct behavior, in each case.

  9. In your ReadMe.txt file, make sure that your name (or names_ and the lab number (lab 4) are at the top of the file, and that you've documented whether you ran into any errors or warnings while developing your solution (and if so what they were) and what the executable program did for each of the trials you ran. Be sure to save your changes to your ReadMe.txt file, as well as those to your source (and header) file(s) before preparing your solution zip file.

  10. Prepare a zip file that contains your project's source, header, and ReadMe.txt files (except for stdafx.h, stdafx.cpp or other Windows-generated files you did not modify), by:

    Send the zip file containing your lab 4 solution as an e-mail attachment to the course e-mail account (cse332@seas.wustl.edu) by the submission deadline for this assignment. If you need to make changes to your lab solution you are welcome to send a new zip file, and we will grade the latest one received prior to the deadline (according to the time stamp the server puts on the e-mail).

    Part III - Extra Credit: (optional, worth up to 5 extra points)

    The goal of the additional requirements for extra credit is to add a third game (Texas Hold 'Em).

    To do that, you should implement the following additional features beyond those in Part II:

  11. Please add a TexasHoldEm class. Make sure that it implements all of the common features of your FiveCardDraw and SevenCardStud solutions, and as noted earlier one good approach is to move as much common functionality as possible up into (possibly private) methods of a common base class. For example collecting antes, saving and restoring players, handling the cases where a player runs out of chips during a round, announcing the winner(s) at the end of each round, etc. should work essentially the same in all games.

    Please implement the following features in your TexasHoldEm class:

  12. Please update your Game class and your main function so that "TexasHoldEm" is recognized as a valid name of a game, and when it is provided should result in a TexasHoldEm game being created and played.

Posted 1:05pm Sunday April 5 2015 by
Chris Gill