to merge
This commit is contained in:
parent
4ec3c66df6
commit
895faaec61
21
main.fs
21
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
|
\ the word pay pays an amount of devices
|
||||||
: pay ( n -- ) s>f devices f@ fswap f- devices f! ;
|
: 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.
|
\ the word hire-chat-member hires a chat member.
|
||||||
: hire-chat-member
|
: hire-chat-member
|
||||||
membercost @ dup !0= swap \ checks if member cost is nonzero, leaving member cost on the stack
|
membercost @ dup !0= swap \ checks if 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
|
can-afford?
|
||||||
and if
|
and if
|
||||||
membercost @ pay
|
membercost @ pay
|
||||||
1 membercount +! \ add a member to the count
|
1 membercount +! \ add a member to the count
|
||||||
membercount @ 2 * 5 + membercost +! \ increase the cost of buying a new member
|
membercount @ 2 * 5 + membercost +! \ increase the cost of buying a new member
|
||||||
membercost 1 changed
|
membercost 1 changed
|
||||||
S" " set-message \ blank the message, because we did a thing.
|
clear-message
|
||||||
then ;
|
then ;
|
||||||
|
|
||||||
\ the word build-construct builds a construct.
|
\ the word build-construct builds a construct.
|
||||||
: build-construct
|
: build-construct
|
||||||
constructcost @ dup !0= swap \ checks if member cost is nonzero, leaving member cost on the stack
|
constructcost @ dup !0= swap
|
||||||
can-afford? \ tests if the member cost (converted to a float) is less than the amount of devices we have
|
can-afford?
|
||||||
and if
|
and if
|
||||||
constructcost @ pay \ remove devices that pay for the construct
|
constructcost @ pay
|
||||||
1 constructcount +! \ add a construct to the count
|
1 constructcount +!
|
||||||
constructcount @ 4 * 10 + constructcost +! \ increase the cost of buying a new construct
|
constructcount @ 4 * 10 + constructcost +!
|
||||||
constructcount 1 changed
|
constructcount 1 changed
|
||||||
S" " set-message \ blank the message, because we did a thing.
|
clear-message
|
||||||
then ;
|
then ;
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in New Issue