ECE 2524

Introduction to Unix for Engineers

BATTLESHIP: The review

Usage

The game Battleship was fun and easy to play. The make file provided worked great and compiled the program with no issues. Upon execution the program was quite intuitive to use. However, for players who have not played Battleship before the way you place moves into the console may not have been straightforward, and could have used some sort of introduction or instruction. Also, when I entered somthing other than a move to the console durring play, the extire game started looping infinitely between the two players views. Could not end the game without a forced stop.

Style

The code was nicely seperated into appropriate files, both .h and .cpp. And the functions within the files seemed to be named appropriately.

However, there were little to no comments in all of the source files, leading to some difficulty figuring out what certain code snippets do. While some variables were properly self-identifying, others were generic and un-documented. The provided code could benifit greatly from comments and proper documentation, as in its current state it is hard to follow. The main.cpp file especially needs to be commented, as it is nearly impossible in its current state to figure out what it is doing.

Philosophy

This code does seem to follow some rules of the Unix Philosophy.

  • The code is seperated into seperate modules, such as Board, Player, and Ship
  • The game is simple and provides a nice interface
  • The output is not cluttered, and provides necessary information

However the main function seems like it could be broken down a bit more into functions

Suggestions

As stated earlier, my main suggestion is better documentation of the code, it could benifit heavily from this and some properly placed comments.

Also, before the players start entering moves it would be nice to explain how to correctly format the moves. This also seems to have faulty error checking, and if I input anything other than the correct format the game loops between the two players screens indefinately, as stated above.

Other than that this is a nicely presented game and was fun to play. Simple and pretty eay to understand, from a player standpoint.