diff options
author | rsiddharth <s@ricketyspace.net> | 2020-06-29 20:00:18 -0400 |
---|---|---|
committer | rsiddharth <s@ricketyspace.net> | 2020-06-29 20:00:18 -0400 |
commit | 112681d88bf5021a4a56b794e7c97d1f57533ff3 (patch) | |
tree | e9301a8dda391c744c6d15f53379c6fc0bf3ac0a /net/ricketyspace | |
parent | fa17fd85108aa349d26cb95d540ad0ba837ba32a (diff) |
fourteen: server.rkt: Update eat-all-the-things
Make new cupcakes appear on the screen every other time one is eaten.
Diffstat (limited to 'net/ricketyspace')
-rw-r--r-- | net/ricketyspace/ror/fourteen/server.rkt | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/net/ricketyspace/ror/fourteen/server.rkt b/net/ricketyspace/ror/fourteen/server.rkt index e551b2f..8088b40 100644 --- a/net/ricketyspace/ror/fourteen/server.rkt +++ b/net/ricketyspace/ror/fourteen/server.rkt @@ -279,13 +279,16 @@ The server is responsible for: ;; determine left-over foods (define (eat-all-the-things player foods) (define b (ip-body player)) - (define (new-cupcake) - (create-a-body CUPCAKE)) + (define (new-cupcakes) + (cond [(> (length foods) 10) '()] + [else + (for/list ([i (in-range (random 1 3))]) + (create-a-body CUPCAKE))])) (for/fold ([foods '()]) ([f foods]) (cond [(body-collide? f b) (set-body-size! b (+ PLAYER-FATTEN-DELTA (body-size b))) - (cons (new-cupcake) foods)] + (append foods (new-cupcakes))] [else (cons f foods)]))) ;; body body -> Boolean |