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