diff options
author | rsiddharth <s@ricketyspace.net> | 2018-06-08 04:21:30 +0000 |
---|---|---|
committer | rsiddharth <s@ricketyspace.net> | 2018-06-08 04:21:30 +0000 |
commit | cc8638ba0248542a11e6094640543e12e01b4e17 (patch) | |
tree | 0be14b4115caa5755bc77f8cd3bc2ceab866fc4b /net/ricketyspace | |
parent | 2fd72c8f915b5eed9e0a054b43f4e6550c4f83c4 (diff) |
net: snake.rkt: Add grow-size.
* net/ricketyspace/ror/six/snake.rkt (grow-size): New function.
Diffstat (limited to 'net/ricketyspace')
-rw-r--r-- | net/ricketyspace/ror/six/snake.rkt | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/net/ricketyspace/ror/six/snake.rkt b/net/ricketyspace/ror/six/snake.rkt index 2931375..abe0a28 100644 --- a/net/ricketyspace/ror/six/snake.rkt +++ b/net/ricketyspace/ror/six/snake.rkt @@ -88,6 +88,10 @@ (define (close? s g) (posn=? s (goo-loc g))) +(define (grow-size sn size) + (cond [(= size 0) sn] + [else (grow-size (grow sn) (- size 1))])) + (define (grow sn) (snake (snake-dir sn) (cons (next-head sn) (snake-segs sn)))) |