File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change 88from ray .rllib .env import MultiAgentEnv
99from utility import create_intial_agents , grid_to_observation
1010
11+ # Don't create the ABMSimulator as argument default: https://docs.astral.sh/ruff/rules/function-call-in-default-argument/
12+ ABM_SIMULATOR = ABMSimulator ()
13+
1114
1215class WolfSheepRL (WolfSheep , MultiAgentEnv ):
1316 def __init__ (
1417 self ,
15- simulator : ABMSimulator | None ,
1618 width = 20 ,
1719 height = 20 ,
1820 initial_sheep = 100 ,
@@ -25,12 +27,8 @@ def __init__(
2527 sheep_gain_from_food = 4 ,
2628 seed = 42 ,
2729 vision = 4 ,
30+ simulator : ABMSimulator = ABM_SIMULATOR ,
2831 ):
29- """Create a new WolfRL-Sheep model with the given parameters."""
30- # Don't create the ABMSimulator as argument default: https://docs.astral.sh/ruff/rules/function-call-in-default-argument/
31- if simulator is None :
32- simulator = ABMSimulator ()
33-
3432 super ().__init__ (
3533 width ,
3634 height ,
You can’t perform that action at this time.
0 commit comments