Use our own hypot() for older Python support
This commit is contained in:
+2
-3
@@ -2,7 +2,6 @@ import collections
|
||||
import re
|
||||
import time
|
||||
import random
|
||||
from math import hypot
|
||||
from itertools import count
|
||||
from copy import copy
|
||||
|
||||
@@ -35,7 +34,7 @@ class World:
|
||||
continue
|
||||
if y_limit and abs(cur[1]) > y_limit:
|
||||
continue
|
||||
if distance and hypot(*cur) > distance:
|
||||
if distance and utils.hypot(*cur) > distance:
|
||||
continue
|
||||
|
||||
check = utils.padd(center, cur)
|
||||
@@ -76,7 +75,7 @@ class World:
|
||||
offset = utils.spiral(n)
|
||||
check = utils.padd(center, offset)
|
||||
if self.block_at(*check) in block_ids:
|
||||
if hypot(*offset) < distance:
|
||||
if utils.hypot(*offset) < distance:
|
||||
result.append(check)
|
||||
if limit and len(result) == limit:
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user