forth/hamucalc.fs

38 lines
735 B
Forth
Executable File

\ hamucalc.fs - HAMURABI game calculator
\ Copyright 2013 David Meyer <papa@sdf.org> +JMJ
\ Copying and distribution of this file, with or without
\ modification, are permitted in any medium without royalty
\ provided the copyright notice and this notice are preserved.
\ This file is offered as-is, without any warranty.
: hamu { pop land grain landpr -- }
pop 20 *
dup cr .\" Grain to feed people:\t" .
land pop 1- 10 * min
dup cr .\" Acres to plant:\t" .
2 * +
grain -
dup 0> if
cr .\" Acres to sell:\t"
landpr 2dup % 0= if
/ .
else
/ 1+ .
then
else
cr .\" Acres to buy:\t"
negate landpr / .
then
cr
;
\ Emacs metadata ...
\ Local variables:
\ mode: forth
\ End:
\ +JMJ