F. Discussion

The creation of the game of Blackjack began with a thorough review of all the available materials provided in the Laboratory Modules. It was decided that the “simple game engine” code with the accompanying retro style card graphics would be incorporated in the GUI design. Next, the outline of the game main aspects was created and a rough draft of the game pseudo-code was written. The pseudo-code was revised several times until the satisfactory, desired final algorithm was achieved. The pseudo-code was then used as a blueprint in writing the MATLAB code. Despite the careful planning of the game, the code writing process proved to be quite challenging. This was due to several factors. First, the game was designed with several, more advanced features, which could have been left out as optional. For example, after each round is played, the game re-calculates the player’s pool and displays the total to the Command Window. When the user enters incorrect information at a prompt, the code keeps displaying various messages to the Command Window, prompting the player to re-enter correct information. When the player runs out of money, the game responds appropriately, by informing the player of insufficient amount of funds in his / her money pool for him / her to continue the game, after which the game is terminated automatically with a goodbye message. In order to achieve this level of complexity, it was necessary for the code to incorporate many various loops – both while-end and for-end loops, nested loops, many if-else as well as if-elseif statements, as well as nested if-else statements, which lead to various programming errors, which had to be identified and resolved. Additional challenge was posed by the five custom functions, which the code utilizes, and which are called multiple times from within the program. In addition to the above, the Graphical User Interface provided in the Laboratory materials was quite challenging, since the provided code used to drive the graphics layers (called “sprites”) was much more complex than the level of material that the course encompassed. Learning to incorporate the retro-cards and developing a functional code, which would correctly stagger the various sprites’ layers, as well as making the cards display in a specific, desired order, and position, perfectly aligned next to each other, was one of the bigger challenges. An effective method in overcoming these challenges was writing code in little snippets and constantly testing, debugging and refining the code until the desired outcome was achieved. Despite of these challenges and difficulties, the process of developing the code was an enormous learning experience allowing the team members not only to learn and understand the material covered in lectures more thoroughly, but also to expand on this material and to significantly add to the MATLAB knowledge base of all the team members. The resulting product is a standard, casino-style Blackjack game with a well designed GUI interface, easy to play and with many user-friendly, easy-to-navigate features.