For the 2026 Old Computer Challenge i selected the 1970s Forest Fire simulation, a BASIC listing from Stimulating Simulations by C. William Engel [1]. This seems appropriate considering that this is the time of year for fireworks and wildfires here on the west coast of the USA. I'll name my version Wildfire. I am aware of two DOS games inspired by Forest Fire: Fire Fighter [2] and Firestorm [3]. These go beyond the scope of what i plan to do this week.
I typed in the BASIC listing [4]. It basically ran without changes.
I changed the output to print the columns double-spaced. This fixes the aspect ratio for a more square grid. I changed the program to seed the RNG based on the system time. This causes it to give a different simulation every time.
I made a few changes to make it compile with FreeBASIC. The CLEAR and RUN statements work differently in FreeBASIC than in QBASIC.EXE, so i changed the code to RESET and GOTO. I posted the resulting WILDFIRE.BAS [5] and WILDFIRE.EXE [6].
My next step will be to convert this to an AWK program. I intend to change the program to use a command style interface. This should make it possible to write more idiomatic AWK code where each command is handled by an AWK pattern and action. I also plan to use chess-style algebraic notation for the grid, which in my opinion will make the commands less ambiguous.
What follows is the book's description of the Forest Fire simulation.
A lightning storm has ignited fires in a forest. Your task is to put out the fires and save as many trees as possible. The forest is divided into 81 sectors formed by a 9x9 grid. Each sector is identified by the number of its row and column. The symbol, ".", represents woods, an "*" represents fire, and a blank space represents burnt out woods.
The chance of an existing fire spreading to adjacent wooded areas is 70%. Fires last for nine turns before burning out.
You have two weapons with which to fight the fire. You can drop chemicals that are designed to extinguish the fires in a specified sector. The chance that the drop will affect the fires in this sector and its eight adjacent sectors is 50%. For example, if there are six fires burning in a nine-square area, approximately three will be affected by the chemicals. The effect of chemicals is to reduce the number of turns before the fire burns out by three. Since a fire lasts only nine turns, three successful chemical hits will be needed to extinguish a fire. If the fire has been burning for six turns, then one hit will suffice.
The second weapon available to you is a backfire. To start a backfire, you must respond to the row input with a zero. You will then be asked for a backfire row and column. The sector in which a backfire is started must be wooded. This backfire will not spread and will burn out in the next turn, forming a barrier against the spread of fire.
Your rating will be the number of trees remaining after all the fires are out, plus 30.
Turn #1
-------
1 2 3 4 5 6 7 8 9
1 . . . . . . . . .
2 . . . . . . . . .
3 . . . . . . . . .
4 . . . . . . . * .
5 . . . . . . . * .
6 . . . * . . . . .
7 . . . . . . . . .
8 . . . . . . . . .
9 . . . . . . . . .
ROW? 0
BACKFIRE ROW? 4
BACKFIRE COLUMN? 7
Turn #2
-------
1 2 3 4 5 6 7 8 9
1 . . . . . . . . .
2 . . . . . . . . .
3 . . . . . . . . .
4 . . . . . . * * .
5 . . . . . . . * .
6 . . . * . . . . .
7 . . * . . . . . .
8 . . . . . . . . .
9 . . . . . . . . .
ROW? 0
BACKFIRE ROW? 5
BACKFIRE COLUMN? 7
Turn #3
-------
1 2 3 4 5 6 7 8 9
1 . . . . . . . . .
2 . . . . . . . . .
3 . . . . . . . . *
4 . . . . . . . * .
5 . . * . . . * * .
6 . . . * . . . * .
7 . . * . . . . . .
8 . . . . . . . . .
9 . . . . . . . . .
ROW? 0
BACKFIRE ROW? 6
BACKFIRE COLUMN? 7
Turn #4
-------
1 2 3 4 5 6 7 8 9
1 . . . . . . . . .
2 . . . . . . . . .
3 . . . . . . . . *
4 . . . . . . * .
5 . . * . . . * *
6 . . . * . . * * .
7 . . * . . . . . .
8 . . . . . . . . .
9 . . . . . . . . .
ROW? 6
COLUMN? 3
Skip forward past turns 5 through 10...
Turn #11
--------
1 2 3 4 5 6 7 8 9
1 . . . * * . * *
2 . . . . * * * .
3 . . . . .
4 . . . . . . .
5 . * . . .
6 * . .
7 . * . . . *
8 . . . . . *
9 . . * . . * . .
ROW? 6
COLUMN? 2
Turn #12
--------
1 2 3 4 5 6 7 8 9
1 . . . * .
2 . . . . .
3 . . . . . .
4 . . . . . . .
5 . . . .
6 . *
7 . .
8 . . . . .
9 . . . . . .
ROW? 8
COLUMN? 7
Skip forward past turns 13 through 15...
Turn #16
--------
1 2 3 4 5 6 7 8 9
1 . . . * .
2 . . . . .
3 . . . . .
4 . . . . . . .
5 . . . .
6 . *
7 . .
8 . . . . .
9 . . . . . .
ROW? 6
COLUMN? 6
YOUR RATING IS 69.
PLAY AGAIN?
L(R,C) -- Grid location status
R -- Row
C -- Column
I -- Row number increment
J -- Column number increment
A -- Adjacent row
B -- Adjacent column
F -- Count
T -- Temporary variable
R -- Rating
0 -- Burnt woods
1 to 9 -- Fire
10 -- Woods
11 -- Temporary variable
[1] Stimulation Simulations by C. William Engel
Edition 1 (1977)