About
Mastermind is a code-breaking game where one player tries to guess a hidden sequence of colors chosen by another; Donald Knuth described an algorithm that can solve any game of Mastermind in five guesses or fewer. BrainCurses is a from-scratch C++ implementation of Mastermind using the Ncurses library for its terminal interface; the player enters a four-color guess (typing the first letter of each color, which autocompletes) and receives markers — red for correct color and position, white for correct color only — after each guess, with 10 guesses allowed by default before the code is revealed.
How it differs from the original
Unlike the original tabletop board game, this version is played entirely through a text terminal using ncurses, with colors selected by typing letter abbreviations rather than placing physical pegs.
Getting started
To play, type the first letter of a color for each of the four guess positions; after the fourth is entered, colored markers reveal how many guesses were exactly right versus merely the right color. Building it requires Ncurses, a C++ compiler, and make.
Additional notes
- Display tip
- The game displays best with a dark terminal background and white foreground; custom color schemes such as Solarized can make the result markers hard to distinguish.