diff --git a/main.fs b/main.fs index 6d06d59..d258521 100644 --- a/main.fs +++ b/main.fs @@ -131,28 +131,31 @@ S" you feel like throwing some stuff into the pool." set-message \ the word pay pays an amount of devices : pay ( n -- ) s>f devices f@ fswap f- devices f! ; +\ the word clear-message clears the onscreen message +: clear-message S" " set-message ; + \ the word hire-chat-member hires a chat member. : hire-chat-member - membercost @ dup !0= swap \ checks if member cost is nonzero, leaving member cost on the stack - can-afford? \ tests if the member cost (converted to a float) is less than the amount of devices we have + membercost @ dup !0= swap \ checks if cost is nonzero, leaving member cost on the stack + can-afford? and if membercost @ pay 1 membercount +! \ add a member to the count membercount @ 2 * 5 + membercost +! \ increase the cost of buying a new member membercost 1 changed - S" " set-message \ blank the message, because we did a thing. + clear-message then ; \ the word build-construct builds a construct. : build-construct - constructcost @ dup !0= swap \ checks if member cost is nonzero, leaving member cost on the stack - can-afford? \ tests if the member cost (converted to a float) is less than the amount of devices we have + constructcost @ dup !0= swap + can-afford? and if - constructcost @ pay \ remove devices that pay for the construct - 1 constructcount +! \ add a construct to the count - constructcount @ 4 * 10 + constructcost +! \ increase the cost of buying a new construct + constructcost @ pay + 1 constructcount +! + constructcount @ 4 * 10 + constructcost +! constructcount 1 changed - S" " set-message \ blank the message, because we did a thing. + clear-message then ;