Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lbforaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def _game_loop(env, render):


def main(game_count=1, render=False):
env = gym.make("Foraging-8x8-2p-2f-v2")
env = gym.make("Foraging-8x8-3p-2f-v2")
obs = env.reset()

for episode in range(game_count):
Expand Down
12 changes: 6 additions & 6 deletions lbforaging/foraging/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ def spawn_food(self, max_food, max_level):

while food_count < max_food and attempts < 1000:
attempts += 1
row = self.np_random.randint(1, self.rows - 1)
col = self.np_random.randint(1, self.cols - 1)
row = self.np_random.integers(1, self.rows - 1)
col = self.np_random.integers(1, self.cols - 1)

# check if it has neighbors:
if (
Expand All @@ -267,7 +267,7 @@ def spawn_food(self, max_food, max_level):
self.field[row, col] = (
min_level
if min_level == max_level
else self.np_random.randint(min_level, max_level)
else self.np_random.integers(min_level, max_level)
)
food_count += 1
self._food_spawned = self.field.sum()
Expand All @@ -288,12 +288,12 @@ def spawn_players(self, max_player_level):
player.reward = 0

while attempts < 1000:
row = self.np_random.randint(0, self.rows)
col = self.np_random.randint(0, self.cols)
row = self.np_random.integers(0, self.rows)
col = self.np_random.integers(0, self.cols)
if self._is_empty_location(row, col):
player.setup(
(row, col),
self.np_random.randint(1, max_player_level),
self.np_random.integers(1, max_player_level),
self.field_size,
)
break
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
],
install_requires=["numpy", "gym>=0.12", "pyglet"],
install_requires=["numpy", "gym>=0.12", "pyglet<=1.5"],
extras_require={"test": ["pytest"]},
include_package_data=True,
)