F. Discussion

Hangman

To build and create the hangman code, an algorithm of how the code should work was first created. This algorithm was then converted into a MATLAB code file. Although building the code for hangman wasn’t extremely difficult, some errors occurred on the way. If the code wasn’t working, the team would first have to identify what the problem is and what section of code the problem is coming from. To identify errors and problems, multiple trials had to be done every time new parts of the code were introduced. The trial and error method used for solving problems was crucial in the development of the code. After all the errors were found and removed from the code, the code was then cleaned up and made more efficient, with pictures added in to give a more authentic hangman feel. If/else statements were very important in making the game fully functional with pictures and commands.

Connect Four

The Connect Four game seemed to be a very simple game to create in Matlab, but it was more challenging than expected. The game and rules themselves are not difficult to understand but we had to figure out how to implement them into code. First, we had to get the game board to be displayed correctly. Once the board was displayed correctly, we ran into a large issue of getting the checker pieces to place correctly on the board. Getting the game pieces displayed wherever we clicked was not challenging, but getting the piece to drop into the columns like the game is supposed to be played. To fix this we had to use if statements to determine determine if a space is taken or not and display the checker piece in the next space up. Lastly, we coded when four checkers are aligned with if statements. When it came to final testing everything in the game worked but the alignment of the checkers. The game would not recognize a diagonal alignment. We fixed this by adding a count within the diagonal if statement. Once this was fixed, everything ran smoothly without any bugs on test day.