Code Comments, Getting Dirty Env, Naming
This commit is contained in:
@ -8,8 +8,9 @@ class SimpleFactory(BaseFactory):
|
||||
super(SimpleFactory, self).__init__(*args, **kwargs)
|
||||
self.slice_strings.update({self.state.shape[0]-1: 'dirt'})
|
||||
|
||||
|
||||
def spawn_dirt(self):
|
||||
free_for_dirt = self.free_cells()
|
||||
free_for_dirt = self.free_cells
|
||||
for x, y in free_for_dirt[:self.max_dirt]: # randomly distribute dirt across the grid
|
||||
self.state[-1, x, y] = 1
|
||||
|
||||
@ -27,10 +28,9 @@ class SimpleFactory(BaseFactory):
|
||||
return 0, {}
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import random
|
||||
factory = SimpleFactory(n_agents=1, max_dirt=8)
|
||||
random_actions = [random.randint(0, 8) for _ in range(200)]
|
||||
for action in random_actions:
|
||||
state, r, done, _ = factory.step(action)
|
||||
state, r, done, _ = factory.step(action)
|
||||
|
Reference in New Issue
Block a user