# 0531ff1bff6b95d97f593be193d2dbbc0945f9fa8efa7fd009ebf12e2c8d0708 Elan 2.0.0-alpha4 valid

main
  variable t set to new Turtle()
  variable paces set to 0
  call t.hide()
  call circle(t, 50)
  for count in range(1, 21)
    call t.placeAt(0, 0)
    variable colour set to randint(red, blue)
    call t.penColour(colour)
    while sqrt(pow(t.x, 2) + pow(t.y, 2)) < 50
      variable angle set to randint(-90, 90)
      call t.turn(angle)
      call t.move(5)
      assign paces to paces + 1
    end while
  end for
  print($"Average number of paces: {paces/20.0}")
end main

procedure circle(t as Turtle, radius as Int)
  variable segment set to radius*pi/180
  call t.placeAt(-radius, 0)
  for count in range(1, 361)
    call t.move(segment)
    call t.turn(1)
  end for
end procedure
