ECE 2524

Introduction to Unix for Engineers

Review of Don't Touch the Zero

Usage

The DTT0 was extremely easy to use. The ‘README’ provided concise instructions to compile and execute their program. The steps were:

$ make
$ ./DTT0

and the game would show a main menu for allowing the user to choose between three different game modes.

I came across an error when playing the Classic gamemode. When chosen, the score does not start out as 0, but a random number, e.g. 1216623296. If I input a letter, the program will automatically decrement your score for 52 lines before exiting because of a seg fault. This only happens in the Classic gamemode. The Freerun and Relay mode works perfectly.

To fix the first problem stated above, add score = 0 in the constructor in the gamemodeB class, they must have forgotten. To fix the other problem would to check if the input is not numerical and between 1-4, then throw an exception error.

Style

The code was very easy to read. Each gamemode has its own class. Just by looking at the code, you can tell that they used a state machine to visualize how their game will work. The board has its own class; and the options (options displayed at the start of the game to choose which gamemode you wish to play) has its own file.

If we go by accepted naming conventions, they did a great job, but I would capitalize the names of each class gamemodeA, gamemodeB, gamemodeC, and board to GamemodeA, GamemodeB, GamemodeC, and Board. Personally I would change istheoneat and userinput to isTheOneAt and userInput, respectively.

Philosophy

The is like the ed pattern because the program needs to be driven by a continuing dialog with the user after startup time. It is a good choice because you need to see the output of the program to enter in the correct input. The program cannot operate in a non-interactive mode if standard input is redirected to a file or pipe. The program follows the Rule of Silence, Rule of Modularity, Rule of Least Surprise, Rule of Transparency, and the Rule of Simplicity.

Conclusion

Overall, it is a good program; a couple bugs stated earlier. I think this game could be improved by adding a Gui. This way, there can be a keyEvent that anytime the key is pressed/released, a signal is automatically sent to check whether or not the input was correct. The game would be more interesting because you have less of a chance to change your initial answer (you cannot Backspace and change your answer). Also the game might be faster because you would not need to hit Enter after every input.