Repository navigation
Add the daily games: System Design Runner, Linux Command Explorer, Docker Commands - #246
Open
AQIB-NAWAB wants to merge 2 commits into
Open
AQIB-NAWAB wants to merge 2 commits into
AQIB-NAWAB wants to merge 2 commits into
Conversation
…cker Commands Three browser games in /puzzles, three rounds each (easy, medium, hard), new every day and the same for everyone. Each round a learner solves for the first time that day earns 3 XP, and finishing all three rounds of one game earns 2 more (33 XP a day at most). A visitor can play without an account. Framework: - shared/games: the GameEngine contract, deterministic daily rotation, and one pure engine per game. The browser plays with the engine for instant feedback, and the server replays the submission with the same engine before it records the round or pays XP. - GamePlay table (migration), game_round and game_set XP sources, a /api/v1/games API (daily set, submit a round), unit and API tests. - Shell: round tabs, result with stars, XP chip and confetti, a mute switch, synthesized sound effects, and a terminal component for the command games. Games: - System Design Runner: 12 AWS incident scenarios (cost, right-sizing, latency, outages, hot keys). Pick a limited set of changes and run a 24-hour traffic simulation against latency, availability and cost goals. - Linux Command Explorer: 14 terminal missions on a made-up server with a shell of about 45 commands, pipes, redirects and permissions. - Docker Commands: 16 scenarios in two modes, a fix-the-container terminal with a live dock view and a visual Dockerfile and compose builder. /puzzles now lists the games instead of the coming soon page.
…the lab board The three daily games now share GameFrame, which copies the lab board's look: a dark header bar with the level and actions, three plain steps, the brief, and a checks list with Wait and Pass badges. The /puzzles hub has a how-it-works strip and flat cards with one Start button each. System Design Runner is now six real incident labs (two per difficulty, with a broken starting board, checks and a reference solution) played on the platform's own HldBoard. The lab model (catalog, types, tiered model, challenge) moved to server/src/shared/lab/engine so the server replays a submitted board with runChallenge before it records the round or pays XP. The old paths in packages/learning-ui re-export it, so existing labs are unchanged. HldBoard gets an optional onRunComplete callback. Linux Command Explorer and Docker Commands are redesigned around GameFrame: a dark terminal, a clear first command, a checks list, one primary action, and a mobile layout. Decorative stars, glow and ship art are removed.
Collaborator
Author
|
Update after review: the games looked generic and hard to use, and the System Design Runner was a custom board instead of the platform lab. This push changes that.
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three playable browser games in
/puzzles, three rounds each (easy, medium, hard), new every day and the same for everyone. A round solved for the first time that day earns 3 XP, and finishing all three rounds of one game earns 2 more. The most the games give is 33 XP a day. A visitor can play without an account and is asked to sign in to save stars and earn XP.The games
grep | sort | uniq -c, find a leaked key, restore a file from backup. Live objective checklist, par, hints.Sound effects (made with Web Audio, no files), stars, confetti, shake on a miss, an XP chip, and a mute switch. Sound is off and decorative motion is reduced when the system asks for reduced motion.
How it is built
server/src/shared/games/<game>/implementingGameEngine(roundsFor(dayKey),parseSubmission,verify). The browser plays with it for instant feedback, and the server replays the submission with the same engine before it records the round or pays XP, so a client cannot claim a win. Details and how to add a game:docs/17-daily-games.mdx.GamePlaytable (migration20261118120000_game_plays), XP sourcesgame_roundandgame_set, and/api/v1/games:GET /daily(open to visitors) andPOST /:game/rounds/:index/submit(signed in, rate limited, size limited).awardXponce per key (game_round:<day>:<game>:<round>,game_set:<day>:<game>), with a daily cap as a backstop. The day is the learner's local day. Replays are free practice./puzzlesshows today's three games with progress, XP earned and a countdown. It replaces the coming soon page.Tests and checks
tests/unit/shared/games(every scenario's stated solution passes, wrong or empty submissions fail, a trap is real, parsing rejects junk, verify never throws, rotation is deterministic and varies by day) andtests/api/games.test.ts(visitor view, auth, bad game or round, unsolved pays nothing, XP paid once, best stars kept, set bonus once).sync-shared:checkclean. Lint: 0 errors in the new code (5 warnings in the Docker build component).Not done, and things to decide
server/src/shared/gamification/xp.ts(3 and 2). No leaderboard yet.prisma migrate deployfor the new table.GAMIFICATION_XPmust be on for XP to be paid.