A Z-machine interpreter written in Haskell. The Z-machine is the virtual machine that ran Infocom's text adventures, such as Zork, A Mind Forever Voyaging, and Wishbringer. The interpreter fully supports versions 3 and 4 and has partial support for version 5.
Stories run in the terminal using ncurses.
Saving and restoring from files is supported via the Quetzal format.
Requires GHC 9.10.x and cabal 3.12 or later.
cabal build
cabal install
Once installed, grue-hs can be run from the terminal:
grue-hs story.z3
An optional random seed can be passed in with --seed N.
You can also run grue-hs from cabal directly (within this folder) like so:
cabal run grue-hs -- STORY.z3
The grue-hs executable opens a full-screen curses interface when run from a terminal. When its input or output is piped, or when run with --console, it falls back to plain stdio.
The cabal test suite runs a set of unit tests along with the (bundled) CZECH conformance suite at versions 3, 4, and 5, and a full save/restore roundtrip against the bundled cloak.z3:
cabal test
To run a single test or group, pass a tasty pattern:
cabal run grue-test -- -p Quetzal
While developing this project, I have relied on fizmo for high-quality code to study, as well as a reference interpreter for transcript comparison.
Additionally, "The Specification of the Z-Machine", by Graham Nelson has been invaluable when implementing the core Z-machine instructions.
BSD-3-Clause. See LICENSE.