add more comments
This commit is contained in:
parent
2ab884d0ef
commit
86f256ee45
17
main.fs
17
main.fs
|
@ -48,13 +48,13 @@ variable membercount
|
|||
|
||||
\ the word hire-chat-member hires a chat member.
|
||||
: hire-chat-member
|
||||
membercost @ dup !0= swap
|
||||
devices @ <=
|
||||
membercost @ dup !0= swap \ checks if member cost is nonzero, leaving member cost on the stack
|
||||
devices @ <= \ tests if the member cost is less than the amount of devices we have
|
||||
and if
|
||||
devices @ membercost @ - devices !
|
||||
devicerate @ 500 - devicerate !
|
||||
1 membercount +!
|
||||
membercount @ 2 * 5 + membercost +!
|
||||
devices @ membercost @ - devices ! \ remove devices that "pay" for the members
|
||||
devicerate @ 500 - devicerate ! \ increase the device rate by 500
|
||||
1 membercount +! \ add a member to the count
|
||||
membercount @ 2 * 5 + membercost +! \ increase the cost of buying a new member
|
||||
then ;
|
||||
|
||||
|
||||
|
@ -69,7 +69,8 @@ variable membercount
|
|||
\ TODO make this be devices/s
|
||||
: print-rate
|
||||
2 set-precision
|
||||
." (" devicerate @ s>f 1000e f/ 1e fswap f/ f. ." devices/second)" ;
|
||||
\ first convert to floating point, divide by 1000 to get seconds from milliseconds, then do 1/n to get the devices/second from seconds/device
|
||||
." (" devicerate @ s>f 1000e f/ 1e fswap f/ f. ." devices/second)" ;
|
||||
|
||||
\ draw-devices draws the number of devices on the screen.
|
||||
: draw-devices
|
||||
|
@ -83,7 +84,7 @@ variable membercount
|
|||
\ draw-actions draws a list of the actions you've unlocked.
|
||||
: draw-actions
|
||||
1 3 at-xy
|
||||
membercost @ dup !0= if
|
||||
membercost @ dup !0= if \ if membercost is non-zero (members have been unlocked)
|
||||
." (h)ire a chat member [" . ." Devices] (you have " membercount @ . ." chat members helping you)" cr
|
||||
else drop then
|
||||
1 move-right ." (q)uit" ;
|
||||
|
|
Reference in New Issue