Skip to content

Instantly share code, notes, and snippets.

@samrat
Created October 6, 2012 13:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samrat/3844987 to your computer and use it in GitHub Desktop.
Save samrat/3844987 to your computer and use it in GitHub Desktop.
(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) null)
((= n 0)
;(print s)
;(newline)
s)
(else (append
(list (use-sword (- (+ n grow) cutA) growA (append s (list 'a))))
(list (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