Daniel Chan
Full stack software engineer in Singapore, currently at QCP.
What's here
The leaderboard
The strongest engineering on the site. Scores are never submitted โ the browser sends the moves it played, and a Cloudflare Function replays them server-side to derive the score itself, so there's no number to tamper with. Verifying a Tic Tac Toe streak originally cost around 9ms of CPU against a roughly 10ms budget; the fix was realising the game only has 183 possible drawn positions, which turns the check from a search into a lookup. Minesweeper is ranked by time, and a time is the one thing a replay cannot prove, so the server is the stopwatch: it starts when the seed is issued and stops when the cleared board arrives. Latency can only make it slower.
See the leaderboardThe games
2048, Snake, Tic Tac Toe and Minesweeper. Each keeps its rules as pure logic in
Play a gamesrc/lib/, with React only in the component โ which is what makes them testable, and what made server-side replay possible at all. A test suite runs on every push, including an exhaustive proof that the Tic Tac Toe AI never loses.Party
A Jackbox-style game for a table of phones. One person opens a room, everyone joins with a four-letter code, and each round the room votes on who is most likely to. Built on the same database as the leaderboard with short polling and optimistic concurrency, so it needs no websockets and no server that stays up.
Open a roomLearn
Short explainers with live demos that run real cryptography in your browser: symmetric and asymmetric encryption, signatures and key exchange on one page, checksums, hashes and hash chains on the other.
Start with encryptionWriting
Nothing published yet.
Read the blog