So after doing yesterday’s post, I thought a little more about doing Hamurabi in Applesoft. I decided it would make sense to do as a base line.
It took about an hour and a half of one handed hunt and pecking to type the listing in. I saved it and ran it. The first thing I noticed was a small but annoying formatting problem. There were no spaces around numbers that were printed. For example, the first instance of this reads:
in year1,0people starved,5came to the city,I made a mental note and continued. I chose not to buy any land by entering 0 and got a:
?SYNTAX ERROR IN 342So I listed line 342
342 IF Q < AT HEN350Oh, yea. Applesoft tokenizes your code to save space. A THEN becomes AT HEN because AT is a reserved word. It was easy enough to fix by putting the expresion (Q<A) in parenthices.
342 IF (Q<A) THEN 350
There was another one at line 445, which I fixed.
445 IF (D<=A) THEN 450At this point, I just listed the program a few lines at a time and looked for any lines that did not look like they were when I typed them. I didn’t find any.
The game is now playable if not pretty.
Now to jump back to my first problem, the missing spaces. It is a simple problem with a slightly tedious fix. The problem, some versions of basic add some spaces before and after the value when printing the values of variables. Applesoft does not and the program is expecting it. One fix is to go throught the program and retype the lines that print variables and correct the spacing as needed.
Side notes:
I found myself referencing The New Apple II User’s Guide as I suspected I would.
Also rather, than work from, either the listing in the book or the listing in the image of the book online. I used a listing from my RSTS/E version and the only thing I found was I had missed a line on my RSTS/E version, which I fixed.

Leave a Reply