A-code (Dave Platt)

From IFWiki

A-code (Dave Platt)
Authoring system
Links Home page Download
Developers Dave Platt, Mike Arnautov
Format Other
Interaction style Parser
Systems Windows, macOS, Linux, iOS, Other
System details A-code can be used on any platform supporting (a) command line and (b) an ANSI C compiler/linker.
Latest version 12.86 / 4 Jan 2022
Status Stable
Uses interpreter
Multimedia support No multimedia as such, but browser builds can support games making use of all HTML capabilities, giving latent multimedia support.
License GPL3
Browse the software database
Edit this infobox

Note that there is a disambiguation page for A-code.

Dave Platt developed the A-code language (not to be confused with the Level 9 A-code system!) for writing his influential "Adventure 3" (now known as Adventure550) expansion of the original Crowther/Woods Adventure game. In doing so, he broke from the traditional format of Adventure and its expanded versions, which relying on a custom executable processing a standard format data file.


The A-code language is a "Polish prefix notation" notation one, where each executable statement consists of an instruction keyword (a "minor directive" or "minor opcode" in Platt's usage), optionally followed by one or more arguments to which the instruction is to be applied. Thus e.g. "add count, 1" is an instruction to increment the value of the the entity "count" by one. Game entities (variables, objects, locations, texts, code chunks...) are declared using "major directives". Full description of the current version of the language can be found in https://mipmip.org/acode/acode-language.html


Platt's implementation of the system consisted of a "munger" which took A-code source of a game and created a tokenised pseudo-binary. The game was then played by running a separate "executive" interpreter, interpreting the psudo-binary. Both programs were written in Fortran 77.

The Current implementation, supported and developed by Mike Arnautov takes an alternative approach. It uses an translator ("acdc") to convert A-code source into derived ANSI C source. This derived source can be then build into standalone executables (using command line console or browser for display and input), executables suitable for CGI or PHP wripper on-line implementations, QT5 executables. It can be further translated by Emscripten into stand-alone HTML/JavaScript web pages.


The Platt version of A-code had some unusual features, such as e.g. "text switches", effectively replacing some code with declarative syntax of game texts, or "procedure groups", where separate chunks of code could bear the same name and be executed in order of their declaration. Both these (and some others) were subsequently built upon in later versions by Mike Arnautov. Thus the basic text switch mechanism got developed into fairly complex "text morphing" (see e.g. https://mipmip.org/acode/acode-texts.html) and to provide powerful means for adding "wizard mode" for game debugging.

As another feature of note, with a minimum of discipline, A-code games can be written to guarantee upward compatibility of saved games. This is invaluable particularly in the beta-testing stage of game development, since objects, locations and general functionality can me added (or fixed) without invalidating game saves generated by a previous version. (See https://mipmip.org/acode/acode-upward.html)


While under the hood A-code parser is a simple verb/noun one (currently no adverbs, instruments or adjectives), it is nevertheless capable of parsing complex sentences, such as e.g. "take all except keys and food then go out". It supports natural use of "it" and also collective nouns "all" and "treasure", features undo and redo. It provides automatic abbreviation of all vocabulary words to the least unambiguous length as well as single-typo error correction. And its vocabulary structure is effectively a 3D one, making it possible automatically to echo back at the player more appropriate versions of command words used.


As already noted, A-code was designed by Dave Platt specifically for writing Adv550 (known version is dated Sep 1972. It was subsequently used by Mike Goetz for the well known Adv580 version of the game. (The A-code source of this was recently recovered from Goetz himself, thereby scotching earlier belief that Adv580 followed the implementation model of the original Adventure.)

Mike Arnautov used A-code in mid-1980s to merge Platt's Adv550 with Luckett's and Pike's Adventure II (now known as Adv440) into Adv660. At some stage in 1990s Mike implemented Roger Firth's "Cloak of Darkness" nano-adventure in A-code. And in 2003 Mike further expanded Adv660 into Adv770. Finally, in 2020, as an exercise, Mike created an A-code implementation of the original Adventure which took the advantage of greatly improved player interaction made possibleby the current version of A-code.

Authoring systems
By style ParserChoiceParser-choice hybrid
By system BrowserAndroidiOSLinuxmacOSWindows
Browse Stable authoring systemsSearch formDrilldown
Other software InterpretersUtilities