Skip to content

Add endless mode for continuous article gameplay - #9

Merged
jhermesn merged 1 commit into
mainfrom
claude/confident-shannon-m9bxei
Sep 30, 2026
Merged

jhermesn merged 1 commit into
mainfrom
claude/confident-shannon-m9bxei

Conversation

@jhermesn

@jhermesn jhermesn commented Sep 30, 2026 •

Copy link
Copy Markdown
Owner

Summary

This PR introduces an "Endless" mode that allows players to solve random articles one after another without waiting for daily puzzles. The mode is browser-local, doesn't affect daily stats or streaks, and provides a continuous gameplay experience.

Key Changes

  • New endless mode module (src/lib/endless.ts): Implements endlessPool() to determine available articles based on released seasons, and pickEndless() to select random articles while avoiding immediate repeats.

  • Storage for endless rounds (src/lib/storage.ts): Added EndlessRound interface and functions loadEndlessRound() and saveEndlessRound() to persist the current endless round per corpus in browser storage.

  • Mode navigation and UI (src/components/Game.astro):

    • Added "New article" button for starting the next endless round
    • Added mode toggle link to switch between Daily and Endless modes
    • Hid stats and sharing UI in endless mode (replaced with "New article" button)
    • Added navigation to switch endless mode across different corpora
  • Main app logic (src/scripts/app.ts):

    • Detects endless mode via ?m=endless URL parameter
    • resolveEndlessRound() loads or creates a new endless round based on the daily pool
    • setUpModeNavigation() manages mode switching UI
    • Endless rounds are saved independently from daily game state
    • Stats are only recorded in daily mode
    • Previous puzzle navigation is hidden in endless mode
    • Meta display shows different text for endless vs. daily modes
  • Internationalization: Added translations for "Endless", "Daily", and "New article" in English and Portuguese, plus updated how-to-play text explaining endless mode.

  • Tests: Added comprehensive test suite for endlessPool() and pickEndless() functions, plus tests for endless round persistence in storage.

Implementation Details

  • Endless mode uses the same daily pool calculation (endlessPool) to ensure articles are only available after their season starts
  • The pickEndless() function prevents immediate article repeats by filtering out the current article when the pool has multiple options
  • Endless rounds are stored per-corpus with a single key, so starting a new round automatically replaces the previous one
  • URL structure: ?c={corpus}&m=endless for endless mode vs. ?c={corpus}&p={puzzle} for daily mode
  • The mode toggle link dynamically updates based on current mode and corpus

Plays random articles from the seasons that have started, one round per
board kept in localStorage. It never feeds the daily stats or streak, and
the result dialog drops the share options, which point at a daily puzzle.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GKSceJ4r6nYngSs8BPV8hg
@jhermesn
jhermesn merged commit efe9944 into main Sep 30, 2026
1 check passed
@jhermesn
jhermesn deleted the claude/confident-shannon-m9bxei branch September 30, 2026 02:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants