Share your repls and programming experiences

← Back to all posts

# Mastermind(2)!

Mastermind is a board game where you guess a color combination using hints from the other player/computer.

This is actually my second version, because I realized that you could play against the computer since the other player only "grades" you.

## How To Play

You can find the same instructions on the page itself :)

-- Scroll to bottom for TL;DR --

Mastermind is a guessing game. The goal is to reveal a combination of colors that the Codemaker creates.

In this game, you are the Codebreaker, the one who finds the combination, and the computer is the Codemaker. There are four positions (0,0,0,0) and there are six possible colors, lime, red, yellow, black, white, and cyan.

To make it easier to guess the code, the Codemaker gives you Hints after each guess. These hints come in four smaller pegs.

To avoid directly giving away the code, the place that each peg is placed in does not matter.

A RED peg indicates that (1)ONE peg in your guess is NOT included in the code, and is NOT in the right position.

A WHITE peg indicates that (1)ONE of your pegs IS a color in the Codemaker's combination, but is NOT in the right position.

An EMPTY/BLACK peg means that you have gotten (1)ONE peg to match a color in the Codemaker's combination, and is in the CORRECT position. You do not need to move or change this peg in subsequent rounds.

This is the entire game. Have fun playing!

TL;DR: Guess a color combination, Codemaker gives response, RED peg response = wrong color, wrong position, WHITE peg response = right color, wrong position, NO peg = right color, right position.

Have fun!
I just wrote this in a few hours, so if you see any issues that make the game unplayable, let me know in the comments :)

NOTE: The reponse/reply pegs are in random order, and this is done on purpose. The position they’re in doesn’t matter