Share your repls and programming experiences

← Back to all posts
Mastermind
h
Roar123 (176)

Mastermind in Python

The classic game of Mastermind is now implemented in Python, meaning you can play the codebreaking game in the comfort of the console.

Rules

The computer has generated a random code - you have to guess it!

Enter your guess as a string of 4 letters, where each letter stands for a color.

Ex. rgbp stands for red, green, blue, and purple from the left to right slot respectively

Here is the complete list of color notation:

Red: r
Blue: b
Green: g
Orange: o
Purple: p
White: w

Red: pin in the right position with correct color
White: pin in wrong position with correct color

Example

Features

  • Color terminal interface
  • Automatic guess enforcement
  • Accurate guess evaluation
  • Turn and score tracking

Is your mind ready for Mastermind? Find out now!

Commentshotnewtop
MrEconomical (1936)

Great work! Finally, a terminal game that isn't garbage

  • EEEEEE
SixBeeps (1410)

Hooh, this is tough

Roar123 (176)

@SixBeeps :) Don't worry - one day you'll become a Mastermind master!

JDOG787 (71)

@SixBeeps how many times have you cracked the code?

mamamia5x (72)

I was making an HTML mastermind game, then this came out. Well done though.

AS06GH (1)

i got it in ten on my first try

CodingClubber (8)

@AS06GH i got 8
this is awesome
i dont get how it works

Roar123 (176)

@CodingClubber Check out the logic in evaluate()

renderthepi (1)

3 red on my first guess, what are the odds?
rgbo
rgbb
rggo
rrbo

B123D321 (0)

This is awesome! Great job!

ags17dewh (0)

hahahahah nice bro!

Powerpasta (0)

This game doesn't work once I get past the loading screen

Roar123 (176)

@Powerpasta Try running the program

DarkBlueWall (5)

woo 3 turns!!
rbgp
rbgo
rbwp