summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEkaitz Zarraga <ekaitz@elenq.tech>2022-11-05 15:02:51 +0100
committerEkaitz Zarraga <ekaitz@elenq.tech>2022-11-05 15:02:51 +0100
commitc69352277774f8cfc5019f12fb6691ff2400f8b7 (patch)
tree3eb725e2cada9745f236a48078e8ea257979136d
parent26b43e773b10d3b8dfe86cc73bc7c065b1c6a5e0 (diff)
Add random state per execution and try it with some game mechanics
-rw-r--r--depre/main.scm56
1 files changed, 41 insertions, 15 deletions
diff --git a/depre/main.scm b/depre/main.scm
index a35411c..964fca3 100644
--- a/depre/main.scm
+++ b/depre/main.scm
@@ -2,6 +2,9 @@
(define-module (depre main)
#:use-module (ice-9 textual-ports))
+;; Random seed
+(set! *random-state* (random-state-from-platform))
+
;; Code makes heavy use of functional code and parameters for state.
(define max-100 (lambda (x) (if (> x 100) 100 x)))
(define %depression (make-parameter 50 max-100))
@@ -112,29 +115,52 @@
`(lambda () ((hash-ref %states ,name))))
(register-state
- 'beginning
- (state "This is the game beginning, as a test"
- (list (cons "Return to start"
+ 'morning-1
+ (state "It's early in the morning. You have time to do whatever you want right now. What do you want to do?"
+ (list
+ (cons "Work."
+ (rest))
+ (cons "Relax."
+ (rest)))))
+
+(register-state
+ 'morning-2
+ (state "It's late in the morning. You still have some time before having lunch. What do you want to do?"
+ (list (cons "nope" (rest)))))
+
+(register-state
+ 'wake-up
+ (state "Good morning. It's time to wake up, what do you want to do?"
+ (list (cons "Wake up and start your day."
(f-or-tired
(combine
- (answer "Alright, you can do that.")
- (rest)
- (to-state 'start))
+ (answer "You just woke up, had your shower, had some breakfast and now you are ready for anything.")
+ (cheer-up)
+ (tire)
+ (to-state 'morning-1))
(combine
- (answer "You are too tired for that")
+ (answer "You are too tired for waking up now. You stay at bed instead and your day starts in mid morning.")
(depress)
- (to-state 'start)))))))
+ (rest)
+ (to-state 'morning-2))))
+
+ (cons "Stay in bed"
+ (combine
+ (answer "You rest for a little bit more, but you feel bad because you have a hard time waking up like a normal person")
+ (depress)
+ (rest)
+ (to-state 'morning-2))))))
(register-state
'start
(state "Hi, game starts"
- (list (cons "Start game"
- (combine
- (answer "Let's start, then. You are getting tired.")
- (tire)
- (to-state 'beginning)))
- (cons "Quit game"
- (answer "Good bye!")))
+ (list
+ (cons "Start game"
+ (combine
+ (answer "Let's start, then. Press [ENTER] to continue.")
+ (to-state 'wake-up)))
+ (cons "Quit game"
+ (answer "Good bye!")))
#:hide-status))
((to-state 'start))