Browse Source

update

main
Justin Senn 2 years ago
parent
commit
e8b420c151
  1. 7
      src/main/java/Snake/Snake.java

7
src/main/java/Snake/Snake.java

@ -91,6 +91,11 @@ public class Snake {
this.direction = direction; this.direction = direction;
} }
public boolean isSelfColliding()
{
var headPosition = bodySegments.get(0);
return bodySegments.stream().anyMatch((point) ->
point.equals(headPosition) && point != headPosition);
}
} }
Loading…
Cancel
Save