CIS501 Assignment 3

10 points; due Thursday, February 26

This is an exercise in refactoring: the revision of an existing program to improve its quality of construction.

You will modify the design and your solution to Assignment 2 so that the Blackjack card game behaves like a reactive system, that is, there is a (single) human guest player who uses a GUI Form with label(s) and button(s) to view his/her hand of cards and to request additional cards for the hand. The human plays against a single, computerized "house player", and there is a separate, "passive output form" that shows the house player's hand of cards. There is another passive output form, a "scoreboard," that shows the score of the human's hand, the current number of rounds, and the wins for the human player.

The GUI Forms that you build must have these features:

+--------------------------------------    +-------------------------------
| Human's Hand                             | Scoreboard
+--------------------------------------    +-------------------------------
|                                          |
|  [ button to Start New Round of Play ]   | (display BJscore of Human's current Hand)
|  [ button to add another card to hand ]  |
|  [ button to "hold" existing hand        | (display number of rounds played)
|     (that is, add no more cards)  ]      | (display Human's wins)
|                                          |
|  (display the Human's hand of cards)     +--------------------------------
+-------------------------------------
                                                                                       
+-------------------------------------
| Computerized House Player's Hand
+-------------------------------------
|                                        
|  (display the House Player's hand of cards)      
+------------------------------------
You are welcome to customize the Forms' appearance as you wish (perhaps you have a nicer-looking alternative than the three distinct buttons on the Human's Hand form), but you must implement these three forms and they must have the input and output features listed above.

Design

You retain the class diagram and the VS Solution for subassembly CardConcepts. You must use Nclass to draw a new class diagram for your own design of the reactive game, now called Blackjack3.

The reactive game has Models, Views, and Controllers: The Deck and Hands are "models"; the Dealer is the main controller and "controls" the Deck; and the Players "control" their Hands. The Forms you design are the "Views".

Design your system to implement the Model-View-Controller software architecture, "Version 3", from Lecture 6.

The card game in Assignment 2 was designed as a simulation, where the Dealer controlled a game with one house player and multiple guest players. (A human just happened to be one of the guest players.) The game here in Assignment 3 is a reactive system that reacts to the human's demands for playing a round and getting cards and holding a hand.

A reactive system runs differently from a simulation, and you must redesign the class diagram from Blackjack2. Don't overdo the changes --- we want to reuse as much code as we can --- but you will be forced to recode some methods and use delegates and event-handling.

Draw your class diagram before you write/alter any code. Revise your class diagram while you code and change the classes, fields, methods, and delegates.

Implementation

You must build a new class diagram, BlackJack3.ncp, and implement your VS Solution BlackJack3 to match the class diagram. (Again, do not alter the class diagram or code for Class Library CardConcepts.)

IMPORTANT: You might find it helpful to redraw the class diagram and write its code in two stages:

For all the non-Form classes in Blackjack3, provide useful unit-tests of the classes' methods in a UnitTests project in Solution Blackjack3.

You must write useful one-line comments for every class and every method in Blackjack3. You should also insert one-line comments for important fields that are declared in the classes. (Look at the comments I inserted into the files in Solution CardConcepts to see what I mean.)

A cute trick --- "slowing down the game":

After the human plays her hand, it is the computerized "house player"s turn. Alas, the house player computes its hand almost instantly, which looks "unrealistic". Also, a game is more fun if there is some suspense in the outcome.

If you wish, you can "slow down" the computerized player so that the human can see the cards dealt to the house player one at a time. There is a simple way to do this:

Submission

Make a folder with the name, MyLastName.MyFirstName.Assn3, and copy into it Zip the folder into a .zip file and submit the .zip file to the CIS501 site on K-State Online.

This is individual work

You must do this exercise solo. This is because I must assess the skills you have acquired so far in your studies. If you have difficulties, we can discuss what can be done to improve your abilities. If I determine that you had unauthorized aid, I will award no points for your work.