Hello Fellow Readers!

Project Summary:

Blackjack is a popular casino card game. The game is played between a player and a dealer, where the object of the game is to get the value of the cards to reach as close to 21 as possible. Using MATLAB code Group F planned and created a Blackjack game where the user plays against a computer dealer. The code included MATLAB functions when taken together created a functioning code allowing for actual game play. The purpose of this was to explore and implement logic and code in order to present a fully functional game.

The beginning of this project started out with a basic algorithm of the game which outlined a step by step process of how the game is played from beginning to end. Using the algorithm as a guideline, the code was put into place. The beginning code took advantage of built in functions, such as “showim()” and “randperm()”, and basic concepts such as number vectors, which assigned values to cards to create the foundations of the game. For example, two vectors were established: one which documented the the order in which the cards appeared in the image file, another which assigned numerical values (card values) to the first vector. Once card value vectors were established, a system for dealing cards from the deck was created.  Some functions were created specifically for the game such as “addcard()” and “sumcard()”, which added a card to a player’s hand and summed the value of the cards in the player’s hand, respectively.

With these functions in place it was possible to create a loop for the player’s turn. The player immediately would enter a loop and the player’s turn would begin by being dealt the first and third card in the array (while the second and fourth card were reserved for the dealer). These cards would appear on the screen. The player would have two cards from the shuffled deck and could see one of the dealer’s cards. The player would have the option to “Stay” (end turn) or “Hit” (simply by typing “hit” or “stay” and was achieved by checking the string for the exact word) which would add a card to the player’s hand from the next card in the vector, the program would calculate the total value of the cards in the player’s hand. So long as the player’s card values had not reached 21 the player could choose to again Hit or Stay. Once the player chose to stay, the dealers turn would begin.

The dealer was programmed to operate independently of the player. The dealer was programmed using simple if then statements: if the dealer card’s were at any point under a score of 17 the program would request another card be added to the dealer’s hand. The dealer would, thus, stop once it’s total was 17 or above. If the dealer went over 21 the player would automatically win.

Finally, a full game loop was implemented in which tied the game together. The player was first prompted to ask if he or she would like to start a game of Blackjack. Included in this full game loop was a betting system, which allowed the player to bet money. The player would start out with $200 and could place a bet between $25 and $100. If the player at any point in the game had a score of 21 or over, the money would be subtracted from the player’s total. Additionally, if after the dealer’s play was over, if the dealer’s score was higher than the player’s the money would be subtracted from the player’s total. Otherwise, (that is, the dealer busted or the player had a higher score than the dealer) the player’s bet would be added to the player’s total. The game continued until the player ran out of money or decided to quit.

Improvements and additions could be made to future versions of this program, such as adding more complex casino rules to the game such as Insurance, Splitting, Double, and Surrender. Additionally, the program could incorporate multiple players. In future versions the graphical interface could be improved to show cards on a virtual Blackjack table as well as animations of the cards being moved from the deck to the players and dealer.


Table Of Contents:
1. Project Management

  • Team Working Agreement
  • Individual Responsibility Agreement
  • Project Schedule
  • Meeting Notes

2. Business Plan

  • User Identification and Interviews
  • Electronic/Print Advertisement
  • Pitch Video with Demonstration

3. Software Documentation

  • Introduction
  • User Manual
  • Program Description for Developers
  • Final Algorithm, Flowchart, or Pseudocode
  • Final Program with Comments
  • Discussion
  • Conclusions and Recommendations
  • References