A Summer Project: Monster Chase, Part 1

Monster Chase is a 48 line BASIC program from “Stimulating Simulations”, published in 1977. The book is 64 pages and is available from the Internet Archive. This program (the second in the book) attracted me as it reminded me a little of an old BSD game (Robots) that I used to spend far too much time playing at university in the early 80s.

The front page of “Stimulating Simulation”, home-published in 1977. This copy was downloaded from the Internet Archive in June 2025 following a Mastodon post by Paolo Amoroso.

The idea behind Monster Chase is straightforward. You and a monster start on opposite corners of a 5×5 grid. You have to survive 10 moves to win the game as the monster advances towards you. The code is very simple, largely built using PRINT and IF statements inside a loop that counts the number of moves made.

Using the Pico MZ-80K emulator I converted the code to run under the Sharp SP-5025 BASIC dialect. The main change from the published code is how boolean conditions are represented. Sharp’s SP-5025 BASIC uses ‘*’ for ‘AND’ and ‘+’ for ‘OR’.

Here’s a Sharp MZ-80K version of the game using the code logic as published:

 5 REM SET CONDITIONS
 10 X=1:Y=1
 20 R=5:C=5
 30 FOR T=1 TO 10
 35 REM DISPLAY GRID
 40 FOR I=1 TO 5
 50 FOR J= 1 TO 5
 70 IF (I=X)*(J=Y) THEN PRINT "M";:GOTO 100
 80 IF (I=R)*(J=C) THEN PRINT "Y";: GOTO 100
 90 PRINT ".";
 100 NEXT J
 110 PRINT
 120 NEXT I
 210 PRINT:PRINT:PRINT "MOVE NUMBER";T
 220 INPUT "DIRECTION (N,E,S,W)";M$
 240 IF M$="N" THEN R=R-1
 250 IF M$="E" THEN C=C+1
 260 IF M$="S" THEN R=R+1
 270 IF M$="W" THEN C=C-1
 280 IF (R*C=0)+(R>5)+(C>5) THEN PRINT "OUT OF BOUNDS":GOTO 520
 290 IF (R=X)*(Y=C) THEN PRINT "EATEN":GOTO 520
 300 IF (X=R)*(Y<C) THEN D=1
 310 IF (X>R)*(Y<C) THEN D=2
 320 IF (X>R)*(Y=C) THEN D=3
 330 IF (X>R)*(Y>C) THEN D=4
 340 IF (X=R)*(Y>C) THEN D=5
 350 IF (X<R)*(Y>C) THEN D=6
 360 IF (X<R)*(Y=C) THEN D=7
 370 IF (X<R)*(Y<C) THEN D=8
 380 D=D+INT(3*RND(1)-1)
 390 IF D=0 THEN D=8
 400 IF D=9 THEN D=1
 410 IF (D>1)*(D<5) THEN X=X-1
 420 IF (D>5) THEN X=X+1
 430 IF (D>3)*(D<7) THEN Y=Y-1
 440 IF (D<3)+(D=8) THEN Y=Y+1
 450 IF X=0 THEN X=X+1
 460 IF Y=0 THEN Y=Y+1
 470 IF X=6 THEN X=X-1
 480 IF Y=6 THEN Y=Y-1
 490 IF (X=R)*(Y=C) THEN PRINT "EATEN":GOTO 520
 500 NEXT T
 510 PRINT "YOU SURVIVED!"
 520 INPUT "PLAY AGAIN";Y$
 530 IF Y$="Y" THEN GOTO 10
 540 END

The book makes a number of suggestions for improving the game (additional monsters, a bigger grid, quicksand, the need for food etc.) that would turn it into something approaching ‘robots’. First things first however – all of those ‘IF’ statements look a little superfluous to my eyes and could be replaced by other BASIC constructs, saving valuable space!

So on days where the weather is sub-optimal this summer I’m going to make my own improvements to this game. Who knows, I may even manage to squeeze something good into 10 lines in time for next year’s BASIC 10 liner competition … perhaps even beating the score of my last very tongue-in-cheek entry 😀

A game of Monster Chase in progress

8th June 2025: a brief diversion into BSD robots

The BSD game robots still exists, of course. I installed it (sudo apt install bsdgames) on my Raspberry Pi 5 ‘daily driver’ a few days ago and I’ve been running it in ‘autobot’ mode (robots -A) since. The autobot’s top five scores (from thousands of games) are currently 7470, 7040, 6840, 6640 and 6640.

I shall probably keep it running until I need to reboot the pi again as it consumes almost no cpu and memory, relatively speaking. I remember it being far, far slower on the VAX 11/750 I used to play it on back in the day but I expect that was because resources were far more limited and there were 20 or 30 other users logged in at the same time!

A game of robots in progress. The right hand side of the screen shows the keyboard mapping, commands, key to the game area and current score.
A game of robots in progress. The keyboard mapping takes a little getting used to!