DEDUCTION GAME

Mastermind online free

Here you do not read a grid: you ask questions. Every guess is an experiment, and the answer tells you how close you were. The code is drawn at the start and never changes — and you do not have to take my word for it, the counter of remaining possibilities proves it at every move.

Tap the colours to build a guess, ⌫ to correct, Guess to submit it. From the keyboard: keys 1 to 8 pick colours, Enter submits. Tapping a peg in the current row clears from there on.

How to play

The game hides a code made of four or five colours. You propose a combination and get two pieces of information: how many pegs are the right colour in the right place (the green marks) and how many are the right colour but in another position (the gold marks).

The marks do not tell you which pegs: only how many. From there on it is all reasoning.

How to reason

The first guess is not for guessing

It is for gathering information. A guess with all different colours says far more than one with four identical pegs, because it splits the space of possibilities into more even slices.

Change one thing at a time

If you swap two pegs around and the number of greens changes, you have learned something precise about those two. If you change three things at once and the result moves, you cannot tell which change caused it.

Watch the counter

The number at the top says how many codes are still consistent with every answer you have received. A good guess makes it collapse; a wasted guess leaves it roughly where it was. It is the fastest way to tell whether you are deducing or guessing.

The options

Frequently asked questions

Does the game change the code while I play?

No. The code is drawn at the start of the game and never modified afterwards. The counter of remaining possibilities makes this verifiable: if the code changed, that number would reach zero while the game was still open.

What do the green and gold marks mean?

Green is a colour in the right place. Gold is a colour present in the code but in another position. The marks do not say which peg they refer to.

What is the possibilities number?

It is how many codes are still consistent with every answer received. It tells you whether a guess brought information: a good guess makes that number collapse.

Is it free?

Yes, it plays free in your browser. No sign-up, no account, no advertising and no data collection: the whole game runs on your device.

Are Mastermind and Bulls and Cows the same game?

They are close relatives. Bulls and Cows is played with digits and was being scribbled on paper well before Mastermind became a board game in the 1970s; the answer mechanic is the same.

Is progress saved?

Yes. The game in progress, with every guess already made, is kept in your browser's local storage: you can close the tab and pick up where you left off.

How it is built

The game is a single page, no libraries and no backend. The interesting part is the counter.

Many versions of mastermind cheat: they change the code while you play, to make you last longer or to stop you winning too soon. Here the code is drawn once at the start and never touched again — but that is a claim, and claims can be checked.

The counter does exactly that: after every guess it enumerates every possible code — at most 32,768 with five positions and eight colours — and counts how many survive all the answers you have received so far. If the game changed the code mid-play, that number would sooner or later hit zero while you were still playing. It never does, and anyone can check.

The same count feeds the hint: when you ask for one, the game offers the first code still consistent. It is not the optimal move in Knuth's sense, but it is always a legitimate one.

It comes out of the same way of working I apply to products: Miraviso is a real case, and if you need a hand with something similar, start here.

← All games