make cover writes build/coverage.out and prints the per-function report; make cover-html renders the same profile to build/coverage.html. The per-package percentage make test prints cannot say which function is untested. Both write files, so neither is in check, and neither may be added to it: check must not modify the working tree. Their output lands under the already-ignored build/. Verified: make cover printed per-function lines and a 62.6% total, make cover-html wrote build/coverage.html, and git status stayed clean. GOFLAGS=-count=1 make check green in 24s with the lint layer executing (12.0s, "0 issues.", not CACHED) and the suite running for real (cmd/rogue 1.037s, game 3.410s); check is still fmt-check lint test and git status is clean afterwards.
3.2 KiB
Rogue: Exploring the Dungeons of Doom (Go port)
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 (1980–1983, 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.
make build
./build/rogue
# Restore a saved game
./build/rogue ~/rogue.save
# View high scores
./build/rogue -s
# Test the death screen (demo mode)
./build/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,ssearch for hidden doors and trapsiinventory,,pick up,ddropqquaff potion,rread scroll,eeat foodwwield weapon,Wwear armor,P/Rput on / remove ringtthrow,zzap a wand,f/Ffight>/<take the stairsSsave,Qquit
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 ./build/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: make test runs scripted command
sequences, dungeon-generation golden checks, and an RNG compatibility test
against the original C generator.
For development, the Makefile wraps the toolchain: make fmt (gofmt +
prettier), make lint (script/lint, which runs golangci-lint inside the
pinned container built from Dockerfile.lint — it is never installed on the
host, so docker is required), make test (the suite, under the race detector
with coverage and a timeout), make check (all three), make build (the
executable), and make cover / make cover-html (per-function coverage, and
the same profile as annotated source at build/coverage.html). Everything they
generate lands in the git-ignored build/. Use the targets rather than the
toolchain directly — they carry the flags the project relies on.
License
BSD-style; see LICENSE.TXT.
Copyright (C) 1980-1983, 1985, 1999 Michael Toy, Ken Arnold and Glenn Wichman. All rights reserved.