The entire solution (about 250 lines of code) is available on my Github. Other solutions have been contributed including Java (150 lines), Lua (185 lines), and Common Lisp (190 lines).

You can run it from the command line:

$ ./factor -run=hamurabi

Or, you can run it from the listener:

( scratchpad ) "hamurabi" run
HAMURABI
CREATIVE COMPUTING MORRISTOWN, NEW JERSEY
TRY YOUR HAND AT GOVERNING ANCIENT SUMERIA
SUCCESSFULLY FOR A TEN-YEAR TERM OF OFFICE
HAMURABI: I BEG TO REPORT TO YOU,
IN YEAR 1, 0 PEOPLE STARVED, 5 CAME TO THE CITY
POPULATION IS NOW 100.
THE CITY NOW OWNS 1000 ACRES.
YOU HARVESTED 3 BUSHELS PER ACRE.
RATS ATE 200 BUSHELS.
YOU NOW HAVE 2800 BUSHELS IN STORE.
...