Rogue and Rog-O-Matic

I’ve seen how many of these tombstones over the years? 😄



Unfortunately, this project has limped along for the past few years. I’m still doing compile/build tests (following Debian testing/unstable package repositories). The good news is that I finally did get a new machine. As of Jan 30th my testing indicates that using -m32 added to CFLAGS both rogue and rogomatic build and run on my 64 bit system (someone must have done some magic in the compiler or libraries because it runs without any code changes better than it did before - I make it to SEED 5399 before an error happens).



In ancient times (the early to mid 1980s, ok, so not quite so ancient 😄 ) there was a Unix curses game called Rogue. Then some people had fun writing another program called Rog-O-Matic which plays Rogue. I won’t admit how much time I spent playing Rogue back then. Even now it is still fun to play. However, back then, the University didn’t allow Rog-O-Matic to run on the machine. I’ve always wanted to see Rog-O-Matic run as it was an early example of “genetic programming”.

A while ago I found a more recent version of Rog-O-Matic and have updated and fixed some bugs to get a version going for Debian Gnu/Linux. For 32 bit systems it should run ok, not all bugs are fixed but it should get somewhere. For 64 bitsystems the mismatches between parameters declared in one place being pointer to char and in other places being int, which causes segfaults when pointers don’t have enough space - so a straight compile will end up with a program which will segfault, but if you add the -m32 option to CFLAGS then the resulting binaries will run.

See the files NEWS and TODO in the LATEST version for known bugs.



Version 2.0.2 is here. Changes to avoid possible bugs, scare monster scroll issues, wand/staff handling when one becomes WORTHLESS (not working fully because of how the pack is reset sometimes). The code surrounding the detection of looping/repeated commands has been removed (don’t need it now). There remains plenty of fine tuning and more bugs to work on. See NEWS, ChangeLog and TODO for more details.



Fix for compile error in mdport.c (added #define NCURSES_INTERNALS).



With the gcc version (Debian 7.2.0-19) 7.2.0, ncurses 6.0+20171125-1 and automake 1.15.1 in Debian testing and unstable looks fine when configuring, building, running (need CFLAGS adjusted for 64 bit systems see above). Previous versions should also work. Note that gcc at the moment has more warnings turned on by default than previous versions (I’m not sure if this will change later or not). I didn’t see anything unexpected so I’ve turned off the warnings by using -w in the CFLAGS environment variable.


ROGUE 3.6.4, 5.4.5:

ROGUE 3.6.4

A while ago, I wanted to try something a little different so I compiled the RRP Version 3.6.4 of rogue from coredumpcentral that had been posted some time ago and copied that resulting binary to /usr/local/bin/rogue (instead of rogue36) which is where rogomatic would expect to find it. I was surprised that it actually did run. The file names in /var/games/rogomatic are a bit confused, but they are there as: (GeneLog362, GenePool362, ltm362 and rgmdelta3.6.4) However, since the RRP version has no hooks for the random number SEED or the PID this will not work with the debugging scripts (I’d have to make quite a few changes to get mainloop to work with a different set of files). This was just an exercise to see if it would run. When the hero dies or is finished it will take some time before the roguelog is renamed to the monster or reason for why the hero stopped. If you want out faster hit ctrl-C and reset the terminal to get back to the normal shell prompt and the files will be left in the current directory (from where you run rogomatic -eh): (debuglog.frogue, debuglog.player, rogomaticpid.# and roguelog). As it doesn’t get all that far or do much this is not how I would recommend running it. The [LATEST] versions do much better.

ROGUE 5.4.5

While testing out more recent compiler versions I’ve been trying to see if I can get rogue version 5.4.5 to work, but as of yet it looks like there are some significant IO changes which means my version of Rogomatic doesn’t work very well when combined with rogue 5.4.5 The number of changes that are different between rogue 5.4.4 and 5.4.5 are large enough it may take some time to figure this out. Likely will end up being yet another winter project…

For best results in running Rog-O-Matic use the most recent versions of Rogue and Rog-O-Matic marked [LATEST] posted below.



As I’ve been doing various tasks over the years I’ve realized that by making as many changes as I did to expand Macros and change indentation that it has made comparisons to other versions much harder on myself than what is needed. With that thought in mind a while ago I tried to start a different track in the Rogue 5.4.4 Source code which makes it easier to do comparisons. The first versions are now available (initial import, set up environment variables and fix the first bug found). As I get more time coming up this winter season I hope I can make more progress. My other reason for doing this is that it may be the case that my changes in the other versions have introduced bugs and I’d like to try something different. By starting at the initial SEED of 1 and then running until I hit a bug (then hopefully fixing that bug without introducing other bugs or altering how the previous runs might turn out) and then continuing past each bug I should have a good set of tests to compare for unintended bugs being introduced. At least that is the theory! We’ll see how it goes… For now though the versions marked LATEST are still the best because they’ve been altered to make things more clear (less ambiguous in some messages that Rogue sends and more bug fixes) [If this changes and these minimal versions seem to be doing better I’ll update this bit]. My fall/winter tinkering in this stuff is probably going to mostly be on this track (when/if i get back to it sometime).

Skip to the DOWNLOADS section below if you aren’t interested in the terminal or debugging scripts…



OTHER THINGS, EXTRAS: Programs/scripts used to scan and debug Rogue and Rogomatic:

  • Two examples of lexical scanners written in C and lex (flex).
  • Plus some debugging scripts used to run Rogomatic/Rogue repeatedly while looking for bugs/errors to happen.


Two scanners (one for Rogue, one for Rogomatic) written in C and lex (flex). The main motivation for writing these was that deciphervt100.c in Rogomatic was not working. It seemed that Rogomatic was getting a strange character sent to it from Rogue (octal 310). Eventually this led me to the bug in Rogue (now fixed in latest version). While I was at it for Rogue I decided to do one for Rogomatic.

Both can be configured to produce three different formats of output:

  1. Control characters converted to “{” “}” enclosed strings all streamed together (no line breaks)
  2. Each code printed on a different line (useful for sorting via sort -u to see what codes are being put out overall)
  3. Only unrecognized codes and characters printed


And the debugging scripts/environment I use.

Please note that Debugging 3.0.0 Changes are not backwards compatible with older versions of Rogue or Rogomatic.

You will need versions: rogomatic-debug-r3.0.0, rogomatic-r2.0.1 and rogue5.4.4-ant-r1.1.1 or later.

Also you will need to set the variables: GETROGOMATICPID, GETROGUEPID and export them in your environment when running mainloop.

Debugging 3.0.3 Changes: Mainloop now checks for segfaults from rogue or rogomatic every two minutes. It also checks for the creation of a core file. cmp2runs doesn’t work for larger data sets, but I did change it to run in the current directory (instead of only working in scratch) – it needs revising to avoid clobbering some files or having things go to a /tmp location or something… gdb-pt (pt-rogo-data and pt-rogue-loop) keep altering them to help me track down bugs. pidcrash was changed to use the bash built in test command.





(216K) Rogue 5.4.4 for the purists - minimal changes

Rogue544 Rgm 1.0.2 Source Code

(219K) Rogue 5.4.4 for Rog-O-Matic [LATEST]

Rogue544 Ant 1.1.4 Source Code


(267K) Rog-O-Matic source code - minimal compile fixes

Rogomatic 0.0.0 Source Code

(287K) Rog-O-Matic source code - many fixes [LATEST]

Rogomatic 2.0.2 Source Code


(216K) Rogue 5.4.4 Minimal Version 0.0.0 - initial import

Rogue Min 0.0.0 Source Code

(217K) Rogue 5.4.4 Minimal Version 0.0.1 - set up environment variables

Rogue Min 0.0.1 Source Code

(217K) Rogue 5.4.4 Minimal Version 0.0.2 - destroy weapon fix

Rogue Min 0.0.2 Source Code



(105K) VtRogue 1.0.0 Rogue output lexical scanner

VtRogue 1.0.0 Source Code


(106K) VtRogomatic 1.0.0 Rogomatic output lexical scanner

VtRogomatic 1.0.0 Source Code


(270K) Rogomatic/Rogue Debugging Scripts [LATEST]

Rogomatic/Rogue Debugging 3.0.3 Scripts


Page Updated: Tue Jan 30 08:56:45 EST 2018