F. Discussion

Testing:

When creating something from scratch one is bound to run into challenges and errors. While testing the code at various points it became evident that allowing users to enter things other than lower case letters would crash the game. When allowing others to test the game, before we had implemented the images used for Hangman it became clear that a need for the number of guesses became necessary. Outside of that there weren’t many issues that had occurred during the testing portion.

MATLAB Code Progression:

The code began with finding a word list and loading the information into MATLAB.  Then the decision was made to create a “difficulty” in which the code sorts through the word list to find a word of appropriate length according to the difficulty. After that, the basics of the actual game state had begun development. Creating the necessary variables and the basic loops to allow continuous game play. The checking of the user input to ensure that only a single letter would be entered and would continue until only until the proper input had occurred. Afterwards, the way that the mystery word is displayed was coded and how the game would check the user input against the mystery word. The way the game checks for a win state using an integer as a numerical check that once reached 0 the game would end or the game would end with a victory if the word was guessed. Finally, the images created were loaded into the game and implemented, the code was cleaned up, and comments were added for clarity.

Obstacles:

Loading the word list into MATLAB proved to be more difficult than expected as the load mechanic would not work with the file. Ultimately MATLAB converted the word list into a single cell that contained all of the words and was usable. The check for the difficulty was the next hurdle, as the group had not learned how to compare strings to be exact. After some research the usage of ‘strcmp’ was discovered and solved the problem. A time consuming problem was creating the ‘letters_correct’ vector. Having it only be characters to match the length of the mystery word proved challenging as again it was not something the group had learned in class. Again research occurred on how to do it and ultimately was a simple fix.