ECE 2524

Introduction to Unix for Engineers

Mastermind Review

Usage

The game was fun fun and reminiscent to Flappy Bird and 2048: I keep losing but I still went back to play again! (https://github.com/kimsib94/Mastermind) The description explained well how to play the game. However, after cloning the source files, I had to compile myself and make some adjustments:

I compiled using g++, and in doing so I was required to use c++11 (-std=c++11) to allow the use of srand().
I also had to #include <cstring> and using std::strcpy; in order to use strcpy.

After I made those minor tweaks, I was able to compile and run the game!

Style

The code was organized and easy to understand. The variables and functions had meaningful names as well.

As for modularity, the use of header files with source files is always a good thing. Maybe the lengthy mastermind() function could have been broken up into smaller functions, but overall, the code is modular. Additionally, having a short and simple main() is always nice and characteristic of modularity!

Philosophy

This program follows many rules of the Unix Philosophy!

  • the mastermind() function is the clear and single strong center of the program, while being supplemented with other smaller modules.
  • the output was nice and clean, and the game was straightforward and simple.

Suggestions

The only suggestions I have are to include the appropriate and libraries in the header, that way it can be compiled in different versions of C++ and on different machines (as Visual Studio probably accomodated for those things). Also, a good practice of secure coding would be to use strncpy() instead of strcopy(), which will prevent accidental buffer overflows.

Overall, the program was well-written and followed many Unixy standards!