From 2fd72c8f915b5eed9e0a054b43f4e6550c4f83c4 Mon Sep 17 00:00:00 2001 From: rsiddharth Date: Fri, 8 Jun 2018 04:20:09 +0000 Subject: net: snake.rkt: Update goo struct. * net/ricketyspace/ror/six/snake.rkt (goo): Add `type`. (decay, fresh-goo): Updat functions. --- net/ricketyspace/ror/six/snake.rkt | 7 ++++--- 1 file 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) -- cgit v1.2.3