Tags

React 19TypeScriptZustand 5Vite 7Tailwind CSS 4gamereacttypescriptlogic

Scalar is a deductive guessing game published at scalargame.com/scalar as part of the ScalarGame platform. A hidden target entity is selected each day via a deterministic PRNG (Mulberry32, seeded by date + category), ensuring all players worldwide see the same puzzle. The goal is to identify it in as few total moves as possible.

How It Works

Submit a guess — any entity in the active category. Every attribute of your guess returns structured feedback with a status, a direction, and a display value. Seven logic types cover every comparison imaginable:

Logic TypeBehavior
EXACT_MATCHBinary — green on match, white on miss
HIGHER_LOWERNumeric comparison with ↑/↓ arrows and percentage-tier proximity
GEO_DISTANCEHaversine great-circle distance between capital cities
CATEGORY_MATCHString equality with optional distance-based gradient coloring
SET_INTERSECTIONOverlap of comma-separated lists, shown as "X/Y" count
TARGETReveals the exact target value directly
NONEAttribute always hidden until a hint is revealed

Feedback uses a thermal color palette: Exact (green), Hot (orange), Near (amber), Miss (white). The same four states appear across all seven logic types, so the learning curve is front-loaded.

Categories

CategoryEntitiesNotable Attributes
Countries195Continent, subregion, hemisphere, area, population, borders, geo distance, timezones
Elements118Atomic number, group, period, phase at STP, family, block, radioactivity
US States50Region, statehood year, area, population, bordering states
CitiesVariesCountry, continent, population, geo distance

Difficulty Modes

Three modes are selectable before the first move. Switching is locked once any move has been made.

ModeAutocompleteHidden FieldsVisualizations
Novice12 suggestionsNoneFree
Scholar6 suggestionsNone+3 moves
Prodigy0 suggestionsShown+10 moves

Visualizations

  • World Map (Countries) — interactive map with the target's region highlighted. The geographic distance cell doubles as an entry point.
  • Periodic Table (Elements) — full interactive table with the target's position revealed.

On Novice, visualizations are free. Scholar costs +3 moves, Prodigy costs +10. Once opened, they stay visible for the rest of the game.

Scoring

Scalar uses a Total Moves system — lower is better. Every action costs moves; credits soften the early game.

ActionCost
Submit a guess+1 move
Reveal a hint (eye icon)+1 move
View visualization on Scholar+3 moves
View visualization on Prodigy+10 moves
Reveal answer (forfeit)Game ends

Players start with 3 free hint credits per game displayed as filled squares in the header.

Modes

  • Daily — counts toward streak and stats; same puzzle for all players worldwide
  • Free Play — random past date, no streak impact, full game preserved
  • Challenge — Base64-encoded URL locks in category, entity, and an optional move target for head-to-head comparisons

Features

  • Guess cards auto-collapse (last 3 expanded, older reduced to a colored summary strip)
  • Collection browser at `/scalar/collection` — browse all previously encountered entities
  • Share card capture via `html-to-image`
  • Autocomplete with fuzzy matching, keyboard navigation, up to 8 suggestions
  • Per-category localStorage persistence — switching categories preserves all in-progress state
  • Data-driven architecture — adding a new category requires only a CSV file and a schema config, no UI changes

Architecture

State lives in a slot-based Zustand store keyed by `(mode, category)`. Per-category JSON is lazy-loaded via Vite code-splitting — no upfront bundle cost for categories the player hasn't touched. The feedback engine in `gameLogic.ts` uses a dispatch pattern over schema-defined logic types, keeping the core loop purely data-driven.