Skip to content

feat(arcade): fill snake stage with more 20px cells - #176

Merged
Anuraj-dev merged 1 commit into
mainfrom
feat/arcade-snake-fill-stage
Aug 17, 2026
Merged

Anuraj-dev merged 1 commit into
mainfrom
feat/arcade-snake-fill-stage

Conversation

@Anuraj-dev

Copy link
Copy Markdown
Owner

Summary

  • Snake's white playfield now fills the arcade cabinet instead of sitting as a small 34x18 letterboxed board.
  • Cells stay a fixed 20 CSS pixels. The board grows by adding more cells, not by scaling or zooming the grid.

Changes

  • Remove the scored-run lock to 34x18 in SnakeGame.
  • Extract boardForStage so menu, measure, and start all use the same whole-cell fit.
  • Add focused tests for the sizing helper and a regression that a scored start uses the measured stage.

Why

The cabinet surface was mostly empty gray around a small white board. The owner asked to enlarge the canvas to that surface without changing pixel scale, gaps, or gameplay rules (speed, food, difficulty, death).

Scores stay on snake-v2. A larger viewport now means a larger field, which is the original fill-by-grid-size design.

Testing

  • Unit tests (stage.test.ts, SnakeGame.test.tsx, snake.test.ts, ArcadeOverlay.test.tsx: 103 passed)
  • Integration tests (not applicable)
  • Manual verification: mock campus, opened Snake, measured 54x27 cells at exactly 20px on a 1096x557 stage (leftover is the 4px inset plus a sub-cell remainder). Played easy/normal; rules unchanged.

Checklist

  • Scope is focused and atomic
  • No debug logs or dead code
  • Naming is clear and consistent
  • No unrelated changes
  • Follows code style guidelines

Scored runs were locked to 34x18, which letterboxed a small
white board inside the cabinet. Keep the original 20px cell
size and grow the grid to the measured stage instead.
@vercel

vercel Bot commented Aug 17, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
2d-metaverse Ready Ready Preview Aug 17, 2026 11:03am

@Anuraj-dev

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 019cabd690

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +275 to +280
const next = measuredRef.current;
setBoard(next);
stateRef.current = initSnake(seed, {
difficulty: d,
width: SCORE_BOARD.cols,
height: SCORE_BOARD.rows,
width: next.cols,
height: next.rows,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep ranked Snake runs on a comparable board

Starting a run with measuredRef.current makes the collision boundary, food distribution, and maximum attainable score depend on the player's viewport/fullscreen state, while ArcadeOverlay still submits every result to the same snake-v2 leaderboard. A player can therefore resize before starting to select anything from the 20×12 minimum to a much larger field, mixing materially different gameplay conditions with existing fixed-34×18 scores; keep ranked dimensions fixed, normalize/version these scores, or make variable-board runs unranked. This also moves a gameplay decision into the renderer despite the repository's pure-rules/thin-renderer invariant.

AGENTS.md reference: AGENTS.md:L71-L74

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Declining this one. The owner asked to fill the cabinet with the same 20px cells (more cells, no scale/zoom). Restoring a fixed 34x18 scored board, versioning scores, or making larger boards unranked would reverse that intent.

The reducer is still dimension-agnostic: initSnake already takes width/height. The renderer only measures how many whole 20px cells fit and passes those numbers in. Scores stay on snake-v2; the leaderboard is already client-trusted at this phase.

@Anuraj-dev
Anuraj-dev merged commit b93df2b into main Aug 17, 2026
7 of 8 checks passed
@Anuraj-dev
Anuraj-dev deleted the feat/arcade-snake-fill-stage branch August 17, 2026 12:14

This branch was successfully deployed

1 active deployment
Preview — 019cabd6 Deployed Aug 17, 2026 by vercel[bot]
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.

1 participant