Extract game rules from Phaser scenes into testable modules

オープン
#40 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
49/100
issue の種類
リファクタリング
明瞭さ
おおむね明確
活発さ
活発
技術スタック
typescript
領域
game-dev, testing

調査の方向性

Start with games/stack/logic.ts and its existing patterns, then inspect games/snake/scenes/GameScene.ts and games/maze/scenes/GameScene.ts; the issue recommends working one game per commit. First establish tests for Stack, then identify the rules and state transitions to extract from Snake and Maze without importing Phaser. Done when both games’ rules have unit tests and the trophy thresholds are checked through a shared helper.

索引モデルが issue の本文から書いたものです。

説明

severity: medium tech-debt

Summary

Stack keeps its rules in a Phaser-free logic.ts. The other nine games keep state, rules, input, audio, HUD and drawing in one scene class, leaving no seam to test. These are the largest and most-changed files in the repo.

Where

  • games/maze/scenes/GameScene.ts:231-531 (movement, chaser targeting, scoring; 650 lines, 32 methods)
  • games/snake/scenes/GameScene.ts:226-374
  • games/stack/logic.ts:104-206 (the pattern to follow)

Details

Trophy score thresholds are also inline magic numbers duplicated against the trophy descriptions (for example games/maze/scenes/GameScene.ts:492 against shared/achievements.ts:66).

Suggested fix

One game per commit, starting with the most-changed:

  1. Add tests for games/stack/logic.ts first to prove the setup.
  2. Snake: extract step, turn buffer, growth, collision and speed-up into games/snake/logic.ts as pure functions with tests, then have the scene call them.
  3. Maze: extract chaser targeting, speed rules and catch detection into games/maze/chase.ts with tests.
  4. Move score thresholds next to the trophy definitions and check them through one shared helper.

Acceptance criteria

  • At least Snake and Maze rules are covered by unit tests that do not import Phaser

Getting started

  • Relevant files: games/stack/logic.ts, games/snake/scenes/GameScene.ts, games/maze/scenes/GameScene.ts, games/breakout/scenes/GameScene.ts
  • Run locally: npm install, then npm run dev
  • Checks: npm run typecheck and npm run build (there is no test suite yet)
  • Related docs: README.md

Filed by repo-audit/full-audit at b001f5d. Severity: medium. Effort: L. audit-key: tech-debt|games/maze/scenes/GameScene.ts|GameScene

主要言語
TypeScript
スター
3
フォーク
3
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

TMHSDigital/GH-Arcade のほかの issue

TMHSDigital/GH-Arcade の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。