Conclusion
During the process of creating the game, there were several obstacles that were encountered. For example, there was difficulty in developing a manner in which all of the surrounding locations of a selected location could be checked for mines. This problem was solved by making an if-else selection structure that could check the values of the surrounding locations in the array that represented the game board. This was done by incrementing the indices of the array by different values depending on the location on the screen. For example, the corner locations each had a different set of locations to check. The top right corner has to check the location below, below to the left, and the location to the left. Another difficulty that was encountered was developing a method to win. This was done by changing the values in theĀ game board array that correspond to touched locations to equal two. then, after each touch, the components of the array are summed and compared to the value of the array if all the non-bomb locations had been touched, changed to a value of two, and summed with the value of the bomb locations. Once the sum is reached, the user has cleared the minefield and won the game. This solution took planning and trial by error. The final difficulty that was encountered was difficulty in testing the game because the mines were randomly generated. To solve this problem, the randomly generated mines were commented out and bombs were manually placed in certain locations. This allowed for the testing of the game. In terms of things that worked well, the for loops used to draw the boards worked well and made symmetric boards. Additionally, once the method for checking the surrounding locations of a selected location was developed it worked well in printing the number of surrounding bombs.
Recommendations
To improve upon the game, there are several features that could be added. For example, adjusting the program to ensure that a bomb could not be uncovered on the first tap. This could be done by generating the random row and column coordinates of the bomb locations in the gameboard array after the first touch had been recorded on the touch screen. An if statement could be used in the code to prevent a bomb from being randomly placed in the location that corresponds to a location that was already touched by the user on the screen. By generating the location of the bombs after the first touch has been made by the user, there is no way that the user could touch a bomb on the first touch. Then, the remaining logic of the code could still be applied. Another reccomendation for the game is that flags could be added to the game. this would involve adding a button board that could be used to select locations on the board that the user suspects to have a bomb. Then, the user could tap these locations and a shape could be printed to that desired location. An if statement could be used to allow for the user to tap the space again to remove the shape. These changes could be implemented with more time.