Rename movement/world methods to idiomatic Go; remove all gotos
Refactor step 4. Renames (C breadcrumbs kept in doc comments): doMove→moveHero, beTrapped→springTrap, rndmove→randomStep, doRooms→digRooms, doPassages→digPassages, doMaze→digMaze, chgStr→changeStrength, doRun→startRun, moveStuff→finishMove, turnref→turnRefresh, moveMonst→moveMonster, doChase→chaseStep, setOldch→setOldChar, cansee→canSee, roomin→roomIn, runto→runTo, conn→connectRooms, putpass→putPassage, passnum→numberPassages, numpass→numberPassage, rndPos→randomPos, rndRoom→randomRoom, treasRoom→treasureRoom, accntMaze→accountMaze. All goto/label flows are gone: moveHero uses a retry loop with the PASSGO corner logic extracted into passageTurn; dispatch re-dispatches via a loop; chaseStep re-checks via a loop; saveGame uses a labeled prompt loop. Control flow and RNG call order are unchanged; suite green.
This commit is contained in:
53
TODO.md
53
TODO.md
@@ -29,14 +29,26 @@ Refactor ground rules:
|
||||
|
||||
# Next Step
|
||||
|
||||
Refactor step 4: method renames, movement/world subsystem
|
||||
(doMove→moveHero, beTrapped→springTrap, rndmove→randomStep,
|
||||
doRooms/doPassages/doMaze→digRooms/digPassages/digMaze,
|
||||
chgStr→changeStrength, ...); remove the goto/label flows in doMove,
|
||||
dispatch, and saveGame in favor of loops and helpers.
|
||||
Refactor step 5: method renames, items/combat/UI subsystems
|
||||
(invName→inventoryName, rollEm→rollAttacks, doPot→applyPotionFuse,
|
||||
getItem→promptPackItem returning (obj, ok), getDir→promptDirection);
|
||||
int status codes (attack returning -1) become named results. Two or
|
||||
three commits, one subsystem each.
|
||||
|
||||
# Completed Steps
|
||||
|
||||
- 2026-07-07 Refactor step 4 (refactor/movement-renames): movement/world
|
||||
renames (doMove→moveHero, beTrapped→springTrap, rndmove→randomStep,
|
||||
doRooms/doPassages/doMaze→digRooms/digPassages/digMaze,
|
||||
chgStr→changeStrength, doRun→startRun, moveStuff→finishMove,
|
||||
turnref→turnRefresh, moveMonst→moveMonster, doChase→chaseStep,
|
||||
setOldch→setOldChar, cansee→canSee, roomin→roomIn, runto→runTo,
|
||||
conn→connectRooms, putpass→putPassage, passnum→numberPassages,
|
||||
numpass→numberPassage, rndPos→randomPos, rndRoom→randomRoom,
|
||||
treasRoom→treasureRoom, accntMaze→accountMaze); all goto/label flows
|
||||
replaced with loops (moveHero retry loop + extracted passageTurn,
|
||||
dispatch re-dispatch loop, chaseStep passage loop, saveGame labeled
|
||||
prompt loop); C breadcrumbs kept in doc comments.
|
||||
- 2026-07-07 Lint adoption finished (refactor/no-package-globals): all
|
||||
37 package-level vars moved into `gameData` (built by `newGameData`,
|
||||
hung on RogueGame as `g.data`, set in NewGame and Restore); ObjectKind
|
||||
@@ -98,41 +110,36 @@ dispatch, and saveGame in favor of loops and helpers.
|
||||
|
||||
# Future Steps
|
||||
|
||||
1. Refactor step 5: method renames, items/combat/UI subsystems
|
||||
(invName→inventoryName, rollEm→rollAttacks, doPot→applyPotionFuse,
|
||||
getItem→promptPackItem returning (obj, ok), getDir→promptDirection);
|
||||
int status codes (attack returning -1) become named results. Two or
|
||||
three commits, one subsystem each.
|
||||
2. Refactor step 6: extract types from the god object — MessageLine
|
||||
1. Refactor step 6: extract types from the god object — MessageLine
|
||||
owns the msg/addmsg/endmsg machinery; pack/inventory operations move
|
||||
onto *Player; monster/object list management and map queries
|
||||
consolidate onto *Level; RogueGame keeps turn orchestration and
|
||||
cross-system effects only.
|
||||
3. Refactor step 7: effects dispatch — the giant quaff/readScroll/doZap
|
||||
2. Refactor step 7: effects dispatch — the giant quaff/readScroll/doZap
|
||||
switches become per-kind handler tables of small named methods,
|
||||
keeping effect order and RNG call sequence identical. This step also
|
||||
clears the outstanding cyclop/gocognit/nestif lint findings.
|
||||
4. Refactor step 8: constructor and style pass per the house
|
||||
3. Refactor step 8: constructor and style pass per the house
|
||||
styleguide — game.New(game.Params{...}) replacing NewGame(Config);
|
||||
replace the gameEnd panic unwind with error-based turn results where
|
||||
feasible; 77-column wrap sweep.
|
||||
5. Docs refresh: update ARCHITECTURE.md Part 2 and README.md for the
|
||||
4. Docs refresh: update ARCHITECTURE.md Part 2 and README.md for the
|
||||
post-refactor names; add the C name → Go name rename table.
|
||||
6. Playtest hardening pass: play several full games with the tcell
|
||||
5. Playtest hardening pass: play several full games with the tcell
|
||||
binary and extend run_test.go to script a deeper multi-level
|
||||
playthrough (descend past level 5, use potions, scrolls, zapping,
|
||||
save/restore). Fix any panics, message mismatches, or divergences
|
||||
from the C behavior that this uncovers, with regression tests.
|
||||
7. Verify the seed-compatibility claim against the C reference on
|
||||
6. Verify the seed-compatibility claim against the C reference on
|
||||
c-master: same seed, same dungeon, same item tables, for several
|
||||
seeds.
|
||||
8. Broaden unit test coverage where playtesting finds thin spots
|
||||
7. Broaden unit test coverage where playtesting finds thin spots
|
||||
(rings, sticks, wizard commands).
|
||||
9. Tag a release once a full game (Amulet retrieval and score entry)
|
||||
8. Tag a release once a full game (Amulet retrieval and score entry)
|
||||
completes without defects.
|
||||
10. Full-terminal-size support (deferred by explicit decision
|
||||
2026-07-06): per-game dungeon dimensions instead of the 80x24
|
||||
constants; open design questions are resize policy, gameplay
|
||||
tuning at larger sizes, and a --classic 80x24 mode.
|
||||
11. Note: this repo is exempt from the standard policy scaffold. Do not
|
||||
9. Full-terminal-size support (deferred by explicit decision
|
||||
2026-07-06): per-game dungeon dimensions instead of the 80x24
|
||||
constants; open design questions are resize policy, gameplay
|
||||
tuning at larger sizes, and a --classic 80x24 mode.
|
||||
10. Note: this repo is exempt from the standard policy scaffold. Do not
|
||||
add Makefile, Dockerfile, or REPO_POLICIES.md.
|
||||
|
||||
Reference in New Issue
Block a user