## Meet the Team!

Chloe Brattoli, Chris Tuttle, Tristan Hamid, Nick Wagner

# MATLAB Games Created

### War (Player vs. Computer)

Group F – Tristan Hamid, Chris Tuttle, Nick Wagner, Chloe Brattoli                                                                                         Software Design Project

Instructor – Mr. Cohen GTA – Mr. Richetti                                                                                                                                       December 12, 2018

### Executive Summary

In this lab, the objective was to combine coding skills with teamwork to create working MATLAB games and accompanying documentation to market to an intended player audience. The importance of the lab is to learn how to apply the MATLAB skills taught in class to create a real life application of coding. The motivation behind the lab is to become better programmers and technical communicators.

The results of the lab include two fully functioning game simulations. These games are played through various user inputs and programmed computer outputs. In War, the simpler of the two MATLAB minigames, the user simply presses ‘1’ and ‘Enter’ to place down each card that will be used against the computer. This process continues throughout the entire game until either the computer or player runs out of cards and therefore loses the game. For Yahtzee, each player rolls die for a series of three rounds in order to get the best possible combination of numbers. The game is controlled through the keyboard’s number pad which is used to choose different die and final combinations to store player points. Once the electronic scorecard is filled, the player with the highest score wins the game. Although both games are played very differently, the common MATLAB code for each game is fundamentally similar. Within each game, for loops, while loops, boolean logic, variables, loading data files, arrays, and user inputs were manipulated to assist in various game play options (A.1-3; B.1-3). Both games can be played error free as long as the player follows the instructions given. However, there is a potential error in both of the games where the game can be “broken” if the player inputs a value not accounted for in the code. One possible way to fix this would be by putting the entire code into a loop that continuously asks for an input until a valid input is entered.

Overall, this lab was a useful way to apply MATLAB skills into a fun and challenging project that is not just a class application assignment. Many of the MATLAB loops and logic taught in class were used in unique ways to create gameplay that is identical to how the games are actually played in real life. Based on the coding process, the team recommends that the best way to create a game is to take your hands off the keyboard and think through how the code will flow first and then begin to type the game (3H. References 1).

Appendix A: Examples of War Code Characteristics

Figure 1: For loop

Figure 2: While Loop

Figure 3: If-Else Statements

Appendix B: Examples of Yahtzee Code Characteristics

Figure 1: For Loop

Figure 2: While Loop

Figure 3: If-Else Statements