ECE 2524

Introduction to Unix for Engineers

Mastermind: A Review

Usage

After playing with kinsib94_mastermind, I can say that it definitely works as advertized. The README provided with enough instructions that I was successfully able to run the program by typing:

$make
$./Mastermind

The code runs without errors and it works as intended, however, there are some issues when it comes to the gameplay. When I played a game, I got a combination and it said that I have 1 number correct in the code at the correct position and 4 numbers correct but in the wrong position (01234). However, when I was returned the answer, it was actually 43314. It didn’t print the correct clues which caused me to lose the game. Also, it doesn’t help that the game closes whenever the player loses the game.

Style

After examining the code more thoroughly, I can tell that the creators designed this program with modularity in mind. The program revolves around the mastermind class, with a secondary class, randomStrGen, that creates the 5-digit code for the player to guess. All input and output is handled by the mastermind class and is efficient in keeping everything within one part of the code.

However, when it comes to organization and usability, we run into some issues. Firstly, the variable names can be seen as confusing, especially the checkers called blackPin and whitePin. The code also doesn’t check if the player has entered a proper guess, making it possible to make a guess with more or less than 5 digits and can even use more characters than what the game specifies. It’s also problematic at the start of the game, where if the player doesn’t type “begin” properly, then the game closes and the player needs to start the game again.

Philosophy

The code follows the standard Filter Pattern, as the program outputs certain information as the player inputs their guesses. This type of pattern works for text-based games such as this because they need to constantly present the player with information about their progress and see if the player is succeeding with their task. However, it requires that a player inputs the data to properly work and will not support input from a .txt file.

In terms of Unix Philosophy, the code follows the Rule of Simplicity and the Rule of Transparency. Most of the code is written within the mastermind method, which handles both input, logic, and output. It’s simple to follow thanks to the type of output that the program presents, making it easy to check if the program is working properly.

Suggestions

One of the main problems with this program is the usability. I suggest redesigning the program so that it operates under the player’s own accord. That means make the program so it will close when the player commands it and ask if they want to play again after winning/losing. Also, I suggest fixing some of the problems I mentioned up above and the program should be ready for release.