1234567891011121314151617181920212223242526272829303132333435363738 |
- #!/usr/bin/guile -s
- !#
- (use-modules (ice-9 rdelim))
- (define (get-character)
- (display "Choose a tall valiant Warrior, a fierce Dragon, or a proud Elf: ")
- (read-line))
- (define (is-warrior? character)
- (eq? character 'warrior))
- (define (is-dragon? character)
- (eq? character 'dragon))
- (define (is-elf? character)
- (eq? character 'elf))
- (display "This is a mystery novel! Choose your character:\n")
- (define character
- (let loop
- ((string (get-character)))
- (cond
- ((string-ci=? string "w") 'warrior)
- ((string-ci=? string "d") 'dragon)
- ((string-ci=? string "e") 'elf)
- (else (begin
- (loop (get-character)))))))
- (cond ((is-dragon? character)
- (display "Hello fierce beast! Don't eat me! \n"))
- ((is-elf? character)
- (display "Hello sir. May I call you Elrond? \n"))
- ((is-warrior? character)
- (display "Hello. May I call your Wolfgar? \n")))
- (display "Your")
|