Audits every case label in C's command.c against this port's dispatch and leaves the audit behind as a standing test, so the two lists cannot drift again. A missing dispatch entry is the one porting error that leaves no trace at build time: the port is function-by-function, so every C function has a Go counterpart and a dropped key dangles nothing, fails to compile nowhere, and simply answers "illegal command" the first time a player presses it. That is how '+' (#11) survived until PR #30 found it by accident. Result: no further missing keys. '+' was the only one. Recording that as a negative result — the class of bug is real, it has now been searched for exhaustively rather than stumbled upon, and the search came back empty. commandHandlers is pinned by set equality in both directions. A missing key is the '+' bug; an extra key is the same bug mirrored, since the likeliest way to acquire one is promoting a key out of the wizard sub-switch, which would expose a MASTER debug command in ordinary play. The main-switch keys that commandHandlers cannot hold - the goto-over re-dispatches, F-to-f, 'a' and 'm' - are covered separately through dispatchKey, because dropping one of those is just as silent as dropping a map entry. Two traps are documented in the file. rogue.h 52-53 defines when as break;case, so a grep for 'case ' finds six of the eighty labels. And the main/wizard split is load-bearing: '+' was a divergence in ordinary play, not just wizard mode, precisely because it is a main-switch key. Confirms this port targets the MASTER build: all four #ifdef MASTER sites in command.c are ported unconditionally, as is sticks.c 237.
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.
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,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 ./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 (golangci-lint), make test (the suite, under the race
detector with coverage and a timeout), and make check (all three). Use the
targets rather than invoking go test 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.