summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEkaitz Zarraga <ekaitz@elenq.tech>2022-11-04 23:38:50 +0100
committerEkaitz Zarraga <ekaitz@elenq.tech>2022-11-04 23:38:50 +0100
commit1d6a79a98c8810b2e05087d978dc963c8d23fc7e (patch)
treecc21bf2010718354236e3e42d37a1d7992071e74
parentaa969e72a34cc3d6e39495a4210442a5e9c7952c (diff)
State checking functions working
-rw-r--r--depre/main.scm21
1 files changed, 14 insertions, 7 deletions
diff --git a/depre/main.scm b/depre/main.scm
index 11b18fc..b59c5c9 100644
--- a/depre/main.scm
+++ b/depre/main.scm
@@ -30,12 +30,12 @@
;; - You are too tired for that, so you do this instead
;; - Or you actually do it
(define (f-or-tired f tired)
- #f
- )
+ (lambda ()
+ (if (< (random 100) (%tiredness)) (f) (tired))))
(define (f-or-depressed f depressed)
- #f
- )
+ (lambda ()
+ (if (< (random 100) (%depression)) (f) (depressed))))
;; Simple I/O
(define (answer message)
@@ -93,9 +93,16 @@
`(lambda () ((hash-ref %states ,name))))
(register-state
- 'begining
+ 'beginning
(state "This is the game beginning, as a test"
- (list (cons "Return to start" (to-state 'start)))))
+ (list (cons "Return to start"
+ (f-or-tired
+ (combine
+ (answer "Alright, you can do that.")
+ (to-state 'start))
+ (combine
+ (answer "You are too tired for that")
+ (to-state 'start)))))))
(register-state
'start
@@ -103,7 +110,7 @@
(list (cons "Start game"
(combine
(answer "Let's start, then.")
- (to-state 'begining)))
+ (to-state 'beginning)))
(cons "Quit game"
(answer "Good bye!")))
#:hide-status))