F. Discussion

Blackjack

For our first game, Blackjack, we attempted to replicate the classic casino game using only the Matlab program. Overall, this went extremely smoothly. In our code, we created two arrays which included both the card name and the card element. Using multiple loops and if-else statements, we were able to create the basic outline of the game, which included the conditions in which the dealer would hit or stand and the option for the user to hit or stand, as well. After this was programmed, we added the win/lose statements that would auto-populate at the end of the game to declare the winner. Our Blackjack game contains the same elements as the normal game and follows the same steps with the only difference being that the dealer isn’t a real person. However, we ran into issues along the way while trying to code the game according to our original plan.

The biggest of these issues occurred when we were attempting to program the deck array. While we were trying to run the game for the first time, we realized that we needed to remove all used cards so that no two cards could be used twice in one round. This took us awhile to solve, but we eventually discovered that we had to create an empty array that would populate with all the used cards after removing them from the deck array. Later, we added a “card_names” array (i.e. “Queen of Hearts”), which corresponded with the the elements of the deck array. At first, this was giving us issues and displaying the wrong card names. We tried creating a different empty array, thinking we had to remove the card names each time just like the deck array. However, we eventually found that the string array for card names inexplicably contained a series of three dots in the middle which caused it to have more elements than necessary. After deleting these dots, the program ran as it should and displayed the correct card names and card values.

Another issue we had was considering all the ways in which the dealer or user could win. Since Blackjack has many tiebreaker rules and caveats that must be taken into consideration, it was difficult to ensure all of them were included in our script. After we ran through it a few times and began to see all the possible results, we were able to refine the win/lose conditions which led to a fully functioning game, awarding the correct winner.

Another issue we had was in regard to images. At first, we wanted to include images with our game. However, the images we found for the cards weren’t compatible with MATLAB. Additionally, we couldn’t find a way to input images in a concise manner without creating an additional hundred or more lines of code. As a result, we decided to scrap the idea of images for our version of Blackjack. We figured that since we have the names of each card display on the screen, it will still be easy to follow and closely resemble the game of Blackjack.

Overall, this game took an entirely different course than we initially intended it to take. Our original plan for the SDP was to create Battleship with an AI. However, after we realized how difficult and time consuming that would be, we decided to create a game that fit our skills and knowledge better. That’s when we came to the conclusion that we were going to program Blackjack. Coding this game wasn’t easy, but it was manageable and within our skill range. Although included in the initial plan, there were some minor elements that we ended up not coding, specifically splitting a hand. There are rare occasions where a person gets two cards of the same value as their first two cards. In this case, a person can split their hand so they have two chances to win. However, this is normally done for betting purposes only since a person can win more money by doing this. Since we decided not to include betting, this aspect of the game seemed unnecessary to code.

Over/Under 7

For our second game, we attempted to replicate another common casino game, Over/Under 7. The code for this game is simple as it asks if you want to bet that the sum of the dice will be over, under, or equal to seven and how much you’d like to bet. This is done using the input function. After the game is played, the wins or losses are applied to the user’s total remaining amount of money. With this game, images were also coded into the game which display the pictures of the rolled dice. For example, if a person rolls a 2 and 6, the images of dice 2 and 6 will be displayed on the screen. Although a late addition to out game lineup, the creation process went more smoothly than Blackjack. This partially had to do with the gameplay being much simpler than Blackjack. Our version of Over/Under 7 contains all the same elements as it would in real life. The only difference is that it is online and the dice aren’t physically rolled.

We came across very few issues during the creation of this game. The only major one worth mentioning is our struggle to include images of the rolled dice that contribute to a more visually appealing, realistic game. At first, we couldn’t figure out how to use Simple Game Engine which kept us from adding the images. Once we figured out how to navigate Simple Game Engine, we ran into the dilemma of whether to use images in the jpg or png format. Eventually, we discovered that png images work best in Simple Game Engine and MATLAB, so we loaded in our images as png files. After this, we were able to perfectly run our game with visuals.

Other than this, there were no major issues or obstacles that we had to overcome for this game. This game, though, took a rather uncertain path to its creation. At first, we had no intention on creating this game. However, after creating the two-point Blackjack game, we wanted to attempt to create another game to get to 4 points for the extra credit. At the beginning of the final week of the project, we decided to create this game, which would be simple enough to complete quickly but difficult enough to get us 2 more points. First, we had to backtrack and do all the preliminary assignments like the ones we did for Blackjack. Once we started coding, we were caught up once again and were able to begin the last step of our software design project.