Skip to content

Commit ab7dc0c

Browse files
committed
adding notes
1 parent 49fb2f6 commit ab7dc0c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

assignment1.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ def actions(self, state):
3434
# Return a list of all allowed actions in a given state.
3535
# Replace the line below with your code.
3636
action=[]
37-
if state[1] is None:
37+
#if no more action, start to find the new way
38+
if state[1] is None:
3839
for i in range(len(state[0][0])):
3940
if state[0][0][i]=='':
4041
action.append(((0,i),'down'))
@@ -45,6 +46,7 @@ def actions(self, state):
4546
action.append(((i,0),'right'))
4647
if state[0][i][len(state[0][i])-1]=='':
4748
action.append(((i,len(state[0][i])-1),'left'))
49+
#if there is a point, find the new way
4850
else:
4951
direction=state[2]
5052
x, y = state[1]
@@ -76,6 +78,7 @@ def result(self, state, action):
7678
point=list(action[0])
7779
direction=action[1]
7880
while point[0]<=len(state[0])-1 and point[1]>=0 and point[1]<=len(state[0][0])-1 and point[0]>=0:
81+
#if the point is out of the map, return the state
7982
if direction=='down':
8083
if point[0]+1>len(state[0])-1:
8184
listState[point[0]][point[1]]=direction
@@ -122,7 +125,6 @@ def goal_test(self, state):
122125

123126
def findhuristic(node):
124127
state=node.state
125-
126128
# Add a penalty for disconnected empty regions to encourage filling contiguous areas
127129
def count_disconnected_regions(grid):
128130
visited = set()

0 commit comments

Comments
 (0)