Handbook
Glossary
report-status ( game -- game )
Vocabulary
hamurabi
.
private
Inputs
game
an
object
Outputs
game
an
object
Definition
USING:
accessors
formatting
io
kernel
;
IN:
hamurabi.private
:
report-status
( game -- game )
"HAMURABI: I BEG TO REPORT TO YOU,"
print
dup
[
year>>
]
[
deaths>>
]
[
births>>
]
tri
"IN YEAR %d, %d PEOPLE STARVED, %d CAME TO THE CITY\n"
printf
dup
plague>>
[
"A HORRIBLE PLAGUE STRUCK! HALF THE PEOPLE DIED."
print
]
when
dup
population>>
"POPULATION IS NOW %d.\n"
printf
dup
acres>>
"THE CITY NOW OWNS %d ACRES.\n"
printf
dup
yield>>
"YOU HARVESTED %d BUSHELS PER ACRE.\n"
printf
dup
eaten>>
"RATS ATE %d BUSHELS.\n"
printf
dup
stores>>
"YOU NOW HAVE %d BUSHELS IN STORE.\n\n"
printf
;