Chore: Remove the use of np.int

This commit is contained in:
LmeSzinc 2023-05-30 10:28:51 +08:00
parent 4382782130
commit 18cba1f9d0
5 changed files with 8 additions and 8 deletions

View File

@ -769,7 +769,7 @@ class ResearchPool:
Returns:
np.ndarray: Shape (188,), lower index means to be selected first. 1000 for not selected projects.
"""
out = np.ones((PROJECTS.count,), dtype=np.int64) * 1000
out = np.ones((PROJECTS.count,), dtype=int) * 1000
for index, project in enumerate(self.filter):
if index != self.reset_index:
out[project.index] = index

View File

@ -54,8 +54,8 @@ def random_rectangle_vector(vector, box, random_range=(0, 0, 0, 0), padding=15):
tuple(int), tuple(int): start_point, end_point.
"""
vector = np.array(vector) + random_rectangle_point(random_range)
vector = np.round(vector).astype(np.int)
half_vector = np.round(vector / 2).astype(np.int)
vector = np.round(vector).astype(int)
half_vector = np.round(vector / 2).astype(int)
box = np.array(box) + np.append(np.abs(half_vector) + padding, -np.abs(half_vector) - padding)
center = random_rectangle_point(box)
start_point = center - half_vector
@ -86,8 +86,8 @@ def random_rectangle_vector_opted(
tuple(int), tuple(int): start_point, end_point.
"""
vector = np.array(vector) + random_rectangle_point(random_range)
vector = np.round(vector).astype(np.int)
half_vector = np.round(vector / 2).astype(np.int)
vector = np.round(vector).astype(int)
half_vector = np.round(vector / 2).astype(int)
box_pad = np.array(box) + np.append(np.abs(half_vector) + padding, -np.abs(half_vector) - padding)
box_pad = area_offset(box_pad, half_vector)
segment = int(np.linalg.norm(vector) // 70) + 1

View File

@ -74,7 +74,7 @@ def insert_swipe(p0, p3, speed=15, min_distance=10):
prev = (-100, -100)
for t in ts:
point = p0 * (1 - t) ** 3 + 3 * p1 * t * (1 - t) ** 2 + 3 * p2 * t ** 2 * (1 - t) + p3 * t ** 3
point = point.astype(np.int).tolist()
point = point.astype(int).tolist()
if np.linalg.norm(np.subtract(point, prev)) < min_distance:
continue

View File

@ -147,7 +147,7 @@ def match_movable(before, spawn, after, fleets, fleet_step=2):
after = after + fleets
x = len(after)
y = len(before)
distance = np.ones((y, x), dtype=np.int) * base_weight
distance = np.ones((y, x), dtype=int) * base_weight
for i1, g1 in enumerate(before):
for i2, g2 in enumerate(after):
distance[i1, i2] = fleet_step - sum(abs(np.subtract(g1, g2)))

View File

@ -171,7 +171,7 @@ class Radar:
for y in range(*self.shape[1]):
if np.linalg.norm([x, y]) > radius:
continue
grid_center = np.round(delta * (x, y) + center).astype(np.int)
grid_center = np.round(delta * (x, y) + center).astype(int)
self.grids[(x, y)] = RadarGrid(location=(x, y), image=None, center=grid_center, config=self.config)
def __iter__(self):