May 2, 2014
This project is a blackjack game that a single person can play against a computer.
- Global Variables and Modifying State: The cards library is different from most of the libraries used, as a lot of the items are globally defined and their state is modified when necessary.
- Recursion: The entire game is played by going through a single loop, which continuously calls itself. Also loops while shuffling the deck
- Functions as Procedures: The hit button has to use this because of the different conditions which it would have to function under. For example, it needs to change which hand it will change in the event of a split hand, so the functions get-p and set-p (for get and set player hand) are sent through the call as lambdas based on if there is a split or not.
In this program, I used two racket libraries: the gui library and the cards library. The gui library was used in order to have the yield statements effectively halt the game while waiting for user input through the buttons that are displayed on screen. The rest was done by the cards library, which allows the use of visible cards, not just a list of cards. The cards library is different in the way it functions since it requires a table (window) to be made and regions to be made on the table for cards to go to.
This is a simple game of blackjack against a computer. There isn't much about it that's too innovative, as blackjack has it's own set of rules that needed to be represented on their own. The program follows all of the rules that I know about with blackjack, and has a very simple "betting" system. There are the standard hit, stand, double, and split buttons at the beginning, and the split and double buttons disappear after the first hit. I also added in that the game will automatically stand if the player hits and ends up with 21.
Technology Used Block Diagram
Create a simple block diagram of your software system that illustrates the major technical components and how they interact; e.g.:
Testing some of the conditions was extremely time consuming and difficult, as a lot of it is dependent on the cards that you're dealt. For example, the auto-stand on 21 condition was broken if 21 happened in a split, as it would skip the second hand if it happened in the first hand or not work at all if it happened in the second hand. After I thought I fixed it, it took a long time before I could be dealt the correct hand to test it again.