Repository navigation
Add endless mode for continuous article gameplay - #9
Merged
Merged
Conversation
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
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.
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): ImplementsendlessPool()to determine available articles based on released seasons, andpickEndless()to select random articles while avoiding immediate repeats.Storage for endless rounds (
src/lib/storage.ts): AddedEndlessRoundinterface and functionsloadEndlessRound()andsaveEndlessRound()to persist the current endless round per corpus in browser storage.Mode navigation and UI (
src/components/Game.astro):Main app logic (
src/scripts/app.ts):?m=endlessURL parameterresolveEndlessRound()loads or creates a new endless round based on the daily poolsetUpModeNavigation()manages mode switching UIInternationalization: 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()andpickEndless()functions, plus tests for endless round persistence in storage.Implementation Details
endlessPool) to ensure articles are only available after their season startspickEndless()function prevents immediate article repeats by filtering out the current article when the pool has multiple options?c={corpus}&m=endlessfor endless mode vs.?c={corpus}&p={puzzle}for daily mode