Prime Pathing HEEELP

I’m on Prime Pathing in Kelvintaph Glacier. Please help me! Thanks soooooooooooo much! :smiling_face_with_three_hearts:
This is my code:

def primeCheck(n):
    for i in range(2,(Math.ceil(Math.sqrt(n)))):
        if n % i == 0:
            return False
    return True

while True:
    n = hero.findHazards()
    if n:

you have to see four hazards at a time. so, you need a function which filters hazards by distance or area.
and, at this level, you should use hero.moveXY or hero.wait.

btw, primeCheck is correct but the real usage to use is this.

hazards = hero.findHazards()
for i in range(len(hazards)):
  hazard = hazards[i]
  if primeCheck(hazard.value):
    hero.say(i + " : prime")
    hero.say(i + " : not prime")
1 Like

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.