diff options
author | rsiddharth <s@ricketyspace.net> | 2018-06-08 04:20:09 +0000 |
---|---|---|
committer | rsiddharth <s@ricketyspace.net> | 2018-06-08 04:20:09 +0000 |
commit | 2fd72c8f915b5eed9e0a054b43f4e6550c4f83c4 (patch) | |
tree | 6ceef7073b890ff79c0bfbddc1f38f984ad29af2 | |
parent | 747ea39e398aedd53e4299e06e6593614088f059 (diff) |
net: snake.rkt: Update goo struct.
* net/ricketyspace/ror/six/snake.rkt (goo): Add `type`.
(decay, fresh-goo): Updat functions.
-rw-r--r-- | net/ricketyspace/ror/six/snake.rkt | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/net/ricketyspace/ror/six/snake.rkt b/net/ricketyspace/ror/six/snake.rkt index 30c4c24..2931375 100644 --- a/net/ricketyspace/ror/six/snake.rkt +++ b/net/ricketyspace/ror/six/snake.rkt @@ -4,7 +4,7 @@ ;; data (struct pit (snake goos dinged)) (struct snake (dir segs)) -(struct goo (loc expire)) +(struct goo (loc expire type)) (struct posn (x y)) ;; constants @@ -130,12 +130,13 @@ (zero? (goo-expire g))) (define (decay g) - (goo (goo-loc g) (sub1 (goo-expire g)))) + (goo (goo-loc g) (sub1 (goo-expire g)) (goo-type g))) (define (fresh-goo) (goo (posn (add1 (random (sub1 SIZE))) (add1 (random (sub1 SIZE)))) - EXPIRATION-TIME)) + EXPIRATION-TIME + (random 1 3))) (define (fresh-goos) (define (gen-goos n) |