From cff171e18473f3be50b5bb904ae7f0dcc4d231fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E7=BF=8A=E5=87=A1?= Date: Sat, 15 Aug 2026 16:17:32 +0800 Subject: [PATCH] fix: replace deprecated np.char.chararray with np.full MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit np.char.chararray is deprecated in numpy 2.5.0 and emits a DeprecationWarning on every call. Replace the construction plus fill loop with np.full, which creates the same 2D single-character grid in one call and works on all numpy versions. The grid now stores unicode characters instead of bytes, so the display loop prints '*' instead of b'*' — no logic depends on the grid values. --- python/Graphs/multi_heuristic_astar.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/python/Graphs/multi_heuristic_astar.py b/python/Graphs/multi_heuristic_astar.py index 38b07e1c..f329c92a 100644 --- a/python/Graphs/multi_heuristic_astar.py +++ b/python/Graphs/multi_heuristic_astar.py @@ -79,10 +79,7 @@ def key(start: TPos, i: int, goal: TPos, g_function: dict[TPos, float]): def do_something(back_pointer, goal, start): - grid = np.char.chararray((n, n)) - for i in range(n): - for j in range(n): - grid[i][j] = "*" + grid = np.full((n, n), "*", dtype="