mirror of
https://github.com/illiumst/marl-factory-grid.git
synced 2025-09-18 00:21:58 +02:00
Documentation
This commit is contained in:

committed by
Steffen Illium

parent
604c0c6f57
commit
855f53b406
@@ -1,6 +1,9 @@
|
||||
from typing import List
|
||||
|
||||
from marl_factory_grid.environment.groups.collection import Collection
|
||||
from marl_factory_grid.modules.doors import constants as d
|
||||
from marl_factory_grid.modules.doors.entitites import Door
|
||||
from marl_factory_grid.utils import Result
|
||||
|
||||
|
||||
class Doors(Collection):
|
||||
@@ -13,16 +16,18 @@ class Doors(Collection):
|
||||
return True
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
A collection of doors that can tick and reset all doors.
|
||||
"""
|
||||
super(Doors, self).__init__(*args, can_collide=True, **kwargs)
|
||||
|
||||
def tick_doors(self, state):
|
||||
def tick_doors(self, state) -> List[Result]:
|
||||
results = list()
|
||||
for door in self:
|
||||
assert isinstance(door, Door)
|
||||
tick_result = door.tick(state)
|
||||
if tick_result is not None:
|
||||
results.append(tick_result)
|
||||
# TODO: Should return a Result object, not a random dict.
|
||||
return results
|
||||
|
||||
def reset(self):
|
||||
|
Reference in New Issue
Block a user