Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
(define cutA 7)
(define growA 3)
(define cutB 5)
(define growB 2)
(define (attack-monster heads)
(use-sword heads 0 '()))
(define (use-sword n grow s)
(cond ((< n 0) 0)
((= n 0)
(print s)
(else (+ (use-sword (- (+ n grow) cutA) growA (append s (list "a")))
(use-sword (- (+ n grow) cutB) growB (append s (list "b")))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment