From 54847e961ceeff2b4d0398e9abda5787a1303756 Mon Sep 17 00:00:00 2001 From: Tawada Date: Thu, 9 Aug 2018 14:54:52 +0900 Subject: [PATCH] Update resolver --- resolver/resolver.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/resolver/resolver.py b/resolver/resolver.py index 4659226..d8162d5 100644 --- a/resolver/resolver.py +++ b/resolver/resolver.py @@ -156,7 +156,7 @@ class MAP: return points[e] def isblank(self, points): - """空白""" + """座標リストのうちラインで埋まっている座標をTrue, ラインで埋まっている座標をFalseとして返す""" l=np.array([],dtype=bool) for point in points: if self.map[tuple(point)]==0: @@ -166,6 +166,7 @@ class MAP: return points[l] def istip(self, points): + """不明:線を伸ばしているとき, 注目している点がその先端かどうかを返す""" l=np.array([],dtype=bool) for point in points: nlist=self.neighbour(point) @@ -220,19 +221,22 @@ class MAP: self.map[self.map==n_line]=0 q=[] + #コスト, 座標, ラインが引かれた方向 heapq.heappush(q, (0, self.line[i][0], [0,0,0])) while True: if q == []: break (priority, point, direction) = heapq.heappop(q) + if point == self.line[i][1]: + break next_points=point+dlist boollist=isregular(next_points) for n, d in zip(next_points[boollist],dlist[boollist]): if self.map[tuple(n)]!=0:continue if len(isregular(next_point))==0:continue if np.array_equal(direction, d): - i + heapq.heappush((priority+1)) def generate(self, linenum, maxlength): -- 2.22.0