diff options
-rw-r--r-- | net/ricketyspace/ror/six/snakes.rkt | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/net/ricketyspace/ror/six/snakes.rkt b/net/ricketyspace/ror/six/snakes.rkt index e76e5df..dae3468 100644 --- a/net/ricketyspace/ror/six/snakes.rkt +++ b/net/ricketyspace/ror/six/snakes.rkt @@ -338,7 +338,11 @@ [else (obstacle-colliding? snake (rest obstacles))])) (define (snake-colliding? snake snake-other) - (cons? (member (snake-head snake) (snake-segs snake-other)))) + (define (head-in-other sn other) + (cond [(empty? other) #f] + [(posn=? sn (first other)) #t] + [else (head-in-other sn (rest other))])) + (head-in-other (snake-head snake) (snake-segs snake-other))) ;; aux (define (posn=? p1 p2) |