# 6697f9e078be7f1ff90f7788a4859a3cfb610389c910588efd4b51f1e76e6991 Elan 1.2.3 guest default_profile valid

main
  let t be new Turtle()
  let radius be 50
  let pace be 5
  call t.hide()
  let segment be 2*radius*pi/360
  call t.placeAt(-50, 0)
  for i from 1 to 360 step 1
    call t.move(segment)
    call t.turn(1)
  end for
  variable totalPaces set to 0
  let numberOfWalks be 100
  for i from 1 to numberOfWalks step 1
    call t.placeAt(0, 0)
    call t.penColour(randomInt(black, white))
    variable pacesThisAttempt set to 0
    while sqrt(t.x^2 + t.y^2) < radius
      call t.move(pace)
      set pacesThisAttempt to pacesThisAttempt + 1
      let randomTurn be randomInt(-90, 90)
      call t.turn(randomTurn)
    end while
    set totalPaces to totalPaces + pacesThisAttempt
  end for
  let average be (totalPaces/numberOfWalks).round(2)
  print "Over {numberOfWalks} attempts, the average no. of paces to edge was {average}"
end main
