Skip to content

Commit

Permalink
fix coordinates
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason committed Mar 29, 2024
1 parent 68b9b48 commit 704521f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,13 @@ def __init__(self, agent_data={}):
if self.matrix:
if self.matrix.action_blacklist:
self.actions = [action for action in self.actions if action not in blacklist]
self.matrix.add_to_logs({"agent_id":self.mid,"step_type":"agent_init","x":self.x,"y":self.y,"name":self.name,"goal":self.goal,"kind":self.kind})
if self.matrix and self.matrix.environment:
valid_coordinates = self.matrix.environment.get_valid_coordinates()
if (self.x, self.y) not in valid_coordinates:
new_position = random.choice(valid_coordinates)
self.x = new_position[0]
self.y = new_position[1]
self.matrix.add_to_logs({"agent_id":self.mid,"step_type":"agent_init","x":self.x,"y":self.y,"name":self.name,"goal":self.goal,"kind":self.kind,"description":self.description,"status":self.status})

def perceived_data_is_same(self):
last_step = self.matrix.cur_step - 1
Expand Down

0 comments on commit 704521f

Please sign in to comment.