sneak 5ba9fe8f66 Adopt house golangci-lint config; fix all approved-linter findings
.golangci.yml is the prompts-repo standard verbatim plus one approved
exception (paralleltest, sneak 2026-07-06). Roughly 1,500 findings
fixed:

- autofix sweep (wsl_v5/nlreturn/intrange/modernize formatting), with
  the misspell autofix REVERTED where it rewrote authentic C game text
  ("missle vanishes" stays, with nolint and a comment)
- error handling: errcheck sites get real handling — saveFile now
  closes explicitly and removes corrupt saves, scoreboard writes are
  documented best-effort, err113 sentinel errors (ErrSaveOutOfDate,
  ErrScreenTooSmall); panics allowed for unrecoverable states per
  MEMORY.md policy
- gosec: real fixes (ParseInt for SEED, 0600 scorefile) and justified
  per-line nolints for provably-bounded conversions (randomMonsterLetter
  helper collapses eight rnd(26)+'A' sites)
- API tidying from linters: pointer receivers on flag types
  (recvcheck), msg helpers renamed addmsgf/doaddf/Printwf/MvPrintwf
  (goprintffuncname), myExit()/findFloor(monst)/mkGameInput(t) drop
  always-constant params (unparam), gameEnd carries no status
- gocritic/staticcheck: if-else chains to switches, the pack.c
  inventory filter untangled into matchesFilter, main.go split so
  defers run before exit (exitAfterDefer, funlen)
- revive doc comments on all exported flag types/consts/methods

Remaining findings are confined to linters pending sneak's exception
decision (mnd, gochecknoglobals, cyclop, nestif, gocognit, exhaustive,
goconst, testpackage); TODO.md records the state. MEMORY.md added at
repo root as the project's agent working notes.
2026-07-07 00:03:45 +02:00
2016-07-23 03:24:54 +01:00
2026-07-06 20:19:33 +02:00
2016-07-23 03:24:54 +01:00
2016-07-23 03:24:54 +01:00

Rogue: Exploring the Dungeons of Doom (Go port)

License

Rogue is the original dungeon-crawling adventure game that spawned an entire genre. This branch is a faithful Go port of Rogue 5.4.4: explore procedurally generated dungeons, fight monsters, collect treasure, and attempt to retrieve the Amulet of Yendor.

Original authors: Michael Toy, Ken Arnold, and Glenn Wichman (19801983, 1985, 1999).

The port is function-by-function faithful to the classic C sources — same dungeon generation (seed-compatible RNG), same combat math, same item tables, same messages. The C reference implementation lives on the master and modern-rogue branches; ARCHITECTURE.md documents both the original program structure and the design of this port.

Building and running

Requires Go 1.25 or later and a terminal at least 80x24.

go build ./cmd/rogue
./rogue
# Restore a saved game
./rogue ~/rogue.save

# View high scores
./rogue -s

# Test the death screen (demo mode)
./rogue -d

In-game commands

Press ? in game for the full list.

  • arrows or h/j/k/l/y/u/b/n — move (shift to run, ctrl to run until adjacent)
  • . rest, s search for hidden doors and traps
  • i inventory, , pick up, d drop
  • q quaff potion, r read scroll, e eat food
  • w wield weapon, W wear armor, P/R put on / remove ring
  • t throw, z zap a wand, f/F fight
  • >/< take the stairs
  • S save, Q quit

Environment

# Game options, as in the original
export ROGUEOPTS="name=YourName,terse,jump,fruit=mango"

# Wizard (debug) mode, with a reproducible dungeon
ROGUE_WIZARD=1 SEED=12345 ./rogue

The scoreboard is kept in ~/.rogue.scores. Save files are Go gob snapshots and, as in the original, are deleted when restored.

Code layout

game/        the game engine: one Go file per original C file,
             function-by-function (see ARCHITECTURE.md for the mapping)
term/        tcell-backed terminal, replacing curses
cmd/rogue/   the executable

The engine package is fully headless-testable: go test ./game/ runs scripted game sessions, dungeon-generation golden checks, and an RNG compatibility test against the original C generator.

License

BSD-style; see LICENSE.TXT.

Copyright (C) 1980-1983, 1985, 1999 Michael Toy, Ken Arnold and Glenn Wichman. All rights reserved.

Description
No description provided
Readme 1.2 MiB
Languages
Go 100%