the doomsday machine

John Conway's Doomsday algorithm, implemented in C++ from handwritten notes โ€” and running live on this site as the unmodified compiled binary.

Doomsday terminal banner

What is this?

Give it any date โ€” it tells you the day of the week using only mental-math steps. No date library, no calendar lookup. It's the same trick human "calendar calculators" perform in their heads, and it was invented by mathematician John H. Conway.

The C++ program behind this site (doomsday.cpp) was written from scratch, by hand, from handwritten notes โ€” then compiled unmodified to WebAssembly, so what runs in your browser is the exact same binary that runs in a Linux terminal. Nothing was rewritten or faked for the web: the prompts, the quirks, even the typos are the real program. Feed it a year, a month and a day, and it walks the algorithm live โ€” century anchor, year doomsday, month anchor โ€” and prints the weekday.

Conway designed the method so the whole calculation fits in your head: a handful of anchor dates per year, one easy formula, and mod 7. With a bit of practice most people land any date in under five seconds โ€” faster than opening a calendar app. This site teaches the method step by step, lets you run the original machine, and then trains you against the clock.

Beyond this page there are two rooms:

โš™๏ธ the terminal

The original doomsday.cpp, compiled to WebAssembly and driving a fake VS Code terminal โ€” typos, backspaces, blinking cursor and all. Every answer comes from the real binary.

open the machine โ†’

๐ŸŽฎ the game

Once you've learned the algorithm, race the clock: random dates across four difficulty tiers up to brutal (any date in years 1โ€“9999). Streaks, hints, achievements, and a daily challenge.

play โ†’

The algorithm in four steps

Every year has a "doomsday" โ€” a weekday that a known set of easy dates all fall on (4/4, 6/6, 8/8, 10/10, 12/12, 5/9, 9/5, 7/11, 11/7, Pi Dayโ€ฆ). Find the doomsday, hop to your date.

1

Century anchor

Anchors cycle over 400 years: 1800s โ†’ Friday, 1900s โ†’ Wednesday, 2000s โ†’ Tuesday, 2100s โ†’ Sunday. The code derives this from a 2000 = Tuesday base instead of a hardcoded table.

2

Year's doomsday

For the last two digits y of the year:

doomsday = anchor + (y / 12) + (y % 12) + ((y % 12) / 4)   (mod 7)
3

Month's anchor date

Each month has a date guaranteed to land on the doomsday:

MonthDoomsdayMonthDoomsday
Jan3rd (4th in leap years)Jul11th
Feb28th (29th in leap years)Aug8th
Mar14th ("Pi day")Sep5th
Apr4thOct10th
May9thNov7th
Jun6thDec12th
4

Step to the target

(day โˆ’ month_anchor) mod 7, added to the year's doomsday, gives the weekday.

Worked example โ€” 21 August 2026

1. 2000s anchor โ†’ Tuesday

2. y = 26: 26/12 = 2, 26%12 = 2, 2/4 = 0 โ†’ 2 + 2 + 2 + 0 = 6 โ†’ doomsday = Saturday

3. August's doomsday is 8/8

4. 21 โˆ’ 8 = 13 โ‰ก 6 (mod 7) โ†’ Saturday + 6 = Saturday โœ”

See it in action

The doomsday machine running in a terminal on Arch Linux
the machine on Arch Linux โ€” the exact binary this site runs
The game's win screen
a win in the game โ€” leap-year Jan/Feb, the classic trap

Learn it yourself

Gregorian calendar only โ€” the machine rejects negative years, exactly like the C++ does. The game's brutal mode stays inside valid Gregorian dates (year 1โ€“9999) and hunts the evil ones instead: century traps, leap-year Jan/Feb shifts, Feb 29s.
โ–ถ run the machine ๐ŸŽฎ play the game