Commit 54847e96 authored by  tawada's avatar tawada

Update resolver

parent 55ace496
...@@ -156,7 +156,7 @@ class MAP: ...@@ -156,7 +156,7 @@ class MAP:
return points[e] return points[e]
def isblank(self, points): def isblank(self, points):
"""空白""" """座標リストのうちラインで埋まっている座標をTrue, ラインで埋まっている座標をFalseとして返す"""
l=np.array([],dtype=bool) l=np.array([],dtype=bool)
for point in points: for point in points:
if self.map[tuple(point)]==0: if self.map[tuple(point)]==0:
...@@ -166,6 +166,7 @@ class MAP: ...@@ -166,6 +166,7 @@ class MAP:
return points[l] return points[l]
def istip(self, points): def istip(self, points):
"""不明:線を伸ばしているとき, 注目している点がその先端かどうかを返す"""
l=np.array([],dtype=bool) l=np.array([],dtype=bool)
for point in points: for point in points:
nlist=self.neighbour(point) nlist=self.neighbour(point)
...@@ -220,19 +221,22 @@ class MAP: ...@@ -220,19 +221,22 @@ class MAP:
self.map[self.map==n_line]=0 self.map[self.map==n_line]=0
q=[] q=[]
#コスト, 座標, ラインが引かれた方向
heapq.heappush(q, (0, self.line[i][0], [0,0,0])) heapq.heappush(q, (0, self.line[i][0], [0,0,0]))
while True: while True:
if q == []: if q == []:
break break
(priority, point, direction) = heapq.heappop(q) (priority, point, direction) = heapq.heappop(q)
if point == self.line[i][1]:
break
next_points=point+dlist next_points=point+dlist
boollist=isregular(next_points) boollist=isregular(next_points)
for n, d in zip(next_points[boollist],dlist[boollist]): for n, d in zip(next_points[boollist],dlist[boollist]):
if self.map[tuple(n)]!=0:continue if self.map[tuple(n)]!=0:continue
if len(isregular(next_point))==0:continue if len(isregular(next_point))==0:continue
if np.array_equal(direction, d): if np.array_equal(direction, d):
i heapq.heappush((priority+1))
def generate(self, linenum, maxlength): def generate(self, linenum, maxlength):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment