summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--depre/main.scm20
1 files changed, 19 insertions, 1 deletions
diff --git a/depre/main.scm b/depre/main.scm
index 525f685..a35411c 100644
--- a/depre/main.scm
+++ b/depre/main.scm
@@ -38,6 +38,21 @@
(lambda ()
(if (< (random 100) (%depression)) (f) (depressed))))
+
+;; State alteration functions for easy access
+(define (tire)
+ (lambda () (%tiredness (+ (%tiredness) 5))))
+
+(define (rest)
+ (lambda () (%tiredness (- (%tiredness) 5))))
+
+(define (depress)
+ (lambda () (%depression (+ (%depression) 5))))
+
+(define (cheer-up)
+ (lambda () (%depression (- (%depression) 5))))
+
+
;; Simple I/O
(define (answer message)
(lambda ()
@@ -103,9 +118,11 @@
(f-or-tired
(combine
(answer "Alright, you can do that.")
+ (rest)
(to-state 'start))
(combine
(answer "You are too tired for that")
+ (depress)
(to-state 'start)))))))
(register-state
@@ -113,7 +130,8 @@
(state "Hi, game starts"
(list (cons "Start game"
(combine
- (answer "Let's start, then.")
+ (answer "Let's start, then. You are getting tired.")
+ (tire)
(to-state 'beginning)))
(cons "Quit game"
(answer "Good bye!")))