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. Once in a while I’m still doing compile/build tests (following Debian testing/unstable package repositories) and minor changes. Recently I have been learning how to use Github and so I have posted the code there for more exposure and easier access or issue reporting.



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 (i386) it should run ok, not all bugs are fixed but it should get somewhere. For 64 bit systems 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. This can be worked around by using the -m32 option in CFLAGS and install the debian package gcc-multilib. I no longer have a 32 bit system to test things out natively so I’m not sure how good this all really works out as I have finally moved on to 64 bit land. I have no idea how this code actually works for other architectures other than i386 and amd64.

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



Version 2.0.3 is here. I increased the morecount so that the program should not give a fatal error for being repeatedly frozen or hit by water. 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 gcc (Debian 10.2.1-6) 10.2.1 20210110, ncurses 6.2+20201114-2 and automake 1.16.3 in Debian testing and unstable looks fine when configuring, building, running (you will need gcc-multilib and 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 pretty much ignoring them, I don’t have the time or interest to do a full code fixup/review).


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

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

Rogomatic 2.0.3 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



I have put all of the rogomatic, rogue, debugging, old archives, and anything else I can think of into various github repositories under:

Please file issues and/or say thanks on github projects if you enjoy tinkering with this code.

Bug fixes always welcome, especially since I’ve not been looking at this much at all for a few years.

The more interaction and appreciation the more likely I will pay more attention to this again.

As I did more work on the code I realized later, after I had made a lot of changes, that the original strategies and intent may have been confused or obscured by some of those changes, but I do not have the time now to go back and redo everything from scratch all over again.


Tue 20 Apr 2021 12:06:29 PM EDT