F. Discussion

During the testing of the game, various challenges arose. While beta testers attempted to play the game, the different strategies used revealed flaws within the code. Most testers approached the game by guessing two pegs of each color. The game was originally designed to use one peg of each color which isn’t the official way Mastermind is played. Without directions to alert them, the testers assumed the game was the same as usual. This provided insight on future improvements that needed to be made. 

The beginning of the programming consisted of calculating the correct order and color of pegs to base all the possible 12 user inputs there could be. The next step was to acquire the user input. Following this the user inputs had to be displayed on the user interface in the order they were given. In order for the user to unveil the correct answer, black pegs needed to be displayed for correct order and color of a peg and white pegs needed to be displayed for any correct color that was input. Once all of this was complete, the final task was to display whether the user won or lost.

During the programming process, a few obstacles occurred with the code. While playing the game, when a correctly colored peg was selected in the right position the value of the peg was not removed from the array which affected multiple pin colors. For example, when a blue peg was selected for the first position which matched the correct solution, the user interface displayed a black pin on the right grid. Although, the same blue peg in that position also caused a white pin to appear on the right grid of the user interface which is incorrect. Solving this required for each correct peg to be removed from the array so that it couldn’t be counted twice. Another problem with the code was similar to the first. Whenever a user input two pegs of the same color, multiple white pins would display on the user interface even though only one peg of that color was correct. In order to solve this, the values of each color pegs that matched were returned to zero in the array so that incorrect white pins would not be displayed.