This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Bit Cryptic World is an interactive puzzle adventure island game with daily cryptic crossword clues. It has two separate applications in one repo:
-
Island Map Game (
index.htmlat root, ~8300 lines) — A standalone vanilla JS/HTML/CSS game where players explore an SVG island map, visit locations, solve cryptic clues, read stories, fish, decorate a house, and unlock achievements. Core systems live injs/as IIFE singletons. Deployed to Vercel as a static site. -
Cryptic Croc Daily Game (
src/directory) — A React 18 + Tailwind CSS app (Create React App) with a daily cryptic clue puzzle featuring a crocodile mascot, plus a Word Play Guide page. Deployed to GitHub Pages. -
game/— A pre-built Vite bundle of a previous version. Referenced bygame/index.htmlwith hashed asset filenames.
npm start # Run the React app dev server (port 3000)
npm run build # Build the React app to /build
npm test # Run Jest tests (react-scripts test, watch mode)
npm run deploy # Build + deploy React app to GitHub Pages via gh-pagesThe root index.html island game has no build step — edit and open directly or serve statically. Vercel deployment config is in vercel.json.
All core systems in js/ use the IIFE singleton pattern, exposing globals:
BCWAudio— Web Audio API synthesized sounds (no audio files), location-based music themesBCWSettings— Settings panel UI with tabs, syncs with other systemsBCWAccessibility— ARIA labels, keyboard navigation, reduced motion, high contrast, font scalingBCWAchievements— Category-based unlock system with toast notificationsBCWSave— localStorage export/import with version trackingBCWAnalytics— Privacy-first anonymous event trackingBCWHints— Progressive hints with difficulty-scaled timersBCWTutorial— 6-step guided onboarding overlayBCWDesigner— In-game SVG element editor (Ctrl+Shift+D)
Scene files in scenes/ populate a global STORY_SCENES object. Keys follow {location}_{step} pattern (e.g., forest_0, beach_1). Each scene is an SVG string with animated backgrounds, narrative text, puzzle content, and choices.
All game state uses localStorage with prefixed keys:
bitcryptic_prefix: progress, unlocked_codes, house, fishingbcw_prefix: audio_settings, accessibility, settings, achievements, analytics, tutorial_complete
js/enhancements.css— Mobile responsiveness (breakpoints: 768px, 480px), accessibility styles, settings/achievements/hints/tutorial panel styles- Root
index.html<style>block — All island map styles (locations, panels, HUD, toolbar, minimap, animations) - Touch targets are 44px minimum;
@media (pointer: coarse)adjustments for mobile
.location— Clickable island map spots.detail-panel,.story-panel,.terminal-panel— Modal dialogs.toolbar,.toolbar-btn— Quick-access location bar.minimap— Viewport indicator.reduced-motion,.high-contrast— Body-level preference classes.keyboard-nav *:focus— Gold outline for keyboard users
src/App.js— HashRouter with two routes:/(CrypticCrocGame) and/indicators(WordPlayIndicators)src/bitCrypticGame.js— Main daily clue game componentsrc/components/WordPlayIndicators.js— Cryptic clue type reference guidesrc/components/ui/button.jsx— Shadcn-style button using class-variance-authoritysrc/lib/utils.js—cn()helper (clsx + tailwind-merge)- Tailwind configured with CSS variable-based HSL color system in
tailwind.config.js
Scene SVGs use <animate> tags, gradient defs, and blur filters. When editing:
- Maintain the
STORY_SCENES['location_step']assignment pattern - SVGs use
viewBoxfor responsive scaling - Test animations in-browser — CSS
@keyframesand SVG<animate>are both used - Designer mode (Ctrl+Shift+D) allows real-time SVG element positioning in the running game
Never add, compose, or reword a cryptic clue anywhere in this project without Joshua's explicit approval. Propose the clue text with its full parse and wait for sign-off before editing files. Mechanical bug fixes are fine; clue content is not. Bonus-challenge clues must never duplicate clues used in the stories. All clue decisions since 2026-07-03 are recorded in data/clue-drafts-2026-07-03.json (approvals, vetoes, rewordings, reserved/spare clues).
The island game is live at https://joshuaroll.github.io/BitCryptic/ (primary, deployed 2026-07-05) and https://bit-cryptic-world.vercel.app (staging mirror). Deploy to Vercel with vercel --prod --yes from the project root. .vercelignore excludes notes/, data/, backups/, src/, and every other dev file containing answers or secret codes — never remove those exclusions. Cache: js/ and scenes/ serve with 5-minute revalidation so testers pick up fixes quickly.
To publish updates to the GitHub Pages copy: copy index.html, js/, and scenes/ (excluding scenes/mockups/) into ../BitCryptic-deploy/, then git commit and git push origin gh-pages from that repo. That repo's root is the live site; /Adventure/ there serves Bit Cryptic Adventure.
showClueChallenge(opts) (index.html, near showGameModal) renders a solvable clue inside a modal: brand-styled input, stepped "Need a hint?" reveals, parse shown only on solving. Every post-story location action uses it — no action may print a clue's answer outright. The observatory's Stargaze challenge also embeds a draggable telescope sky (telescopeHtml() + initTelescope()).
- Clue database:
src/data/dailyClues.js— 30 verified clues with hints, types, and difficulty ratings - Selection:
getDailyClue(dateString)uses days-since-epoch modulo the pool, so every clue is reached in rotation; rollover is local midnight (component remounts on date change) - Persistence:
bitcryptic_daily_{YYYY-MM-DD}in localStorage saves solved state, attempts, guess history - Streaks:
bitcryptic_daily_streaktracks current/longest streaks src/data/dailyClues.test.jsmachine-verifies all clue wordplay (anagram letter math, hidden-word contiguity, enumerations, definition-substring, rotation coverage) — keep it passing- Daily-clue content expansion is on hold per Joshua ("we do not need daily clues now")
data/clue-archive.json is the master archive of every cryptic clue in the game. It is currently stale (predates the 2026-07 clue overhaul) and needs regenerating from live sources; until then, data/clue-drafts-2026-07-03.json is the accurate ledger of recent clue changes. Before modifying or removing any clue from the game, ensure it's preserved in one of these files.
BCWAudio synthesizes all sounds via Web Audio API oscillators — there are no audio files. Audio context is lazy-initialized on first user interaction (browser autoplay policy). Separate gain nodes control master, music, SFX, and ambient channels.