From 1d6a79a98c8810b2e05087d978dc963c8d23fc7e Mon Sep 17 00:00:00 2001 From: Ekaitz Zarraga Date: Fri, 4 Nov 2022 23:38:50 +0100 Subject: State checking functions working --- depre/main.scm | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'depre') 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)) -- cgit v1.2.3