F. Discussion

Creating the game “battleship” in MATLAB went very well. Its grid-based nature lent itself to easy modeling with matrices and simple checks could be performed to determine game status. The group decided on battleship as the sole game after deliberating about the difficulty of programming battleship vs. alternative games and considering the point reward for such a game. Four points put the group above the minimum complexity rating of three and battleship, compared to other 4 point games, seemed easy to program. The provided example battleship sprite sheet was used due to its easy availability and ability to be edited.

The game was developed in 4 separate parts at the same time; each group member worked on a specific part of the project. The separate parts were then recombined into a single program and tested heavily for bugs.

BOARD

The board was selected as one of the first things to program, because all other parts of the game would be played out on it. At first, the board was a simple single 21×10 matrix with water and blank sprites, but soon evolved into a single 21×15 matrix to include a menu, which then turned into 3 separate matrices: a 21×10 for the visual part, and 2 10×10 matrices for AI and User ship boards. This occurred because during testing, getting the AI to select only its 10×10 section of the 21×15 board proved difficult. It could be easily resolved by simply adding the AI board values to the visual board where needed.

AI Targeting

As soon as the team finished the board generation they began work on the AI targeting function. In the early stages of development it started off as a function that would just guess randomly on the top 10×10 board that was generated. As we continued to work on it it became smarter and could guess more accurately. If the hardest difficulty is selected the AI will first target randomly until it gets a hit then, once it does, it will guess around the area that it hit until the ship is sunk. The integration of the AI targeting and the board generated by simple game engine was probably the biggest hurdle that the team had to overcome during this whole design process but through constant trial and error eventually all of the bugs were fixed and the two functions were integrated.

 

Well written and complete (Discusses the process of game creation, results of testing, refinements of code etc.)