Skip to content

Commit

Permalink
Update env.py
Browse files Browse the repository at this point in the history
edit borders (it should not be done before init_agent_loc)
  • Loading branch information
jooyoung-korea committed Apr 4, 2021
1 parent 69fdda4 commit 194fd92
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions environment/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@ def __init__(self, max_height: int, max_width: int, max_num_walls: int, num_hide
self.map = np.zeros((self.width, self.height))

# initial agent and wall locations
self.wall_loc = self.make_walls() # 이러면 맵 부르자 마자 wall 함수도 돌아가는 건가?
self.wall_loc = self.make_walls() # 이러면 맵 부르자 마자 wall 함수도 돌아가는
agent_loc = self.init_agent_loc()
self.agent_loc = [tuple(np.array(i).reshape(-1)) for i in agent_loc] # list of tuples
self.agent_loc = [tuple(np.array(i).reshape(-1)) for i in agent_loc] # list of tuples

# print("Initial state of the map with agents(1: walls, 2: hiders, 3: seekers)")
# print(self.map)
self.map = np.pad(np.array(self.map), pad_width=1, mode='constant', constant_values=1.)
print("Initial state of the map with agents(1: walls, 2: hiders, 3: seekers)")
print(self.map)

# 아래 agent_state 함수 참고
self.agent_vision = np.array([[0, 0, 0]] * (self.num_seekers + self.num_hiders))
Expand Down Expand Up @@ -89,8 +90,9 @@ def make_walls(self): # (x,y) is the starting point
self.map[(x_, y_)] = 1
wall_loc.append((x_, y_))

walls = np.pad(np.array(wall_loc), pad_width=1, mode='constant', constant_values=1.)
return walls
# print(f'wall_loc: {wall_loc}')

return wall_loc

def init_agent_loc(self):
"""
Expand Down

0 comments on commit 194fd92

Please sign in to comment.