Skip to content

Commit cd68651

Browse files
committed
[Football] FIx AI heuristic with 1 agent only
1 parent 7dc49f7 commit cd68651

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

vmas/scenarios/football.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -983,13 +983,16 @@ def policy(self, agent):
983983
# Dribble with the ball
984984
self.dribble_to_goal(agent, env_index=dribble_mask)
985985
# If other agent is passing/shooting, stay still
986-
other_agent_shooting_mask = self.combine_or(
987-
[
988-
self.actions[otheragent]["pre-shooting"]
989-
| self.actions[otheragent]["shooting"]
990-
for otheragent in self.teammates
991-
if (otheragent != agent)
992-
]
986+
other_agents_shooting = [
987+
self.actions[otheragent]["pre-shooting"]
988+
| self.actions[otheragent]["shooting"]
989+
for otheragent in self.teammates
990+
if (otheragent != agent)
991+
]
992+
other_agent_shooting_mask = (
993+
self.combine_or(other_agents_shooting)
994+
if len(other_agents_shooting)
995+
else False
993996
)
994997
stay_still_mask = other_agent_shooting_mask & ~shooting_mask # hmm
995998
self.go_to(
@@ -1697,7 +1700,9 @@ def can_pass(self, agent_dest, env_index=Ellipsis):
16971700
__file__,
16981701
control_two_agents=True,
16991702
continuous=True,
1700-
n_blue_agents=3,
1701-
n_red_agents=3,
1703+
n_blue_agents=2,
1704+
n_red_agents=2,
1705+
ai_red_agents=True,
1706+
ai_blue_agents=False,
17021707
dense_reward_ratio=0.001,
17031708
)

0 commit comments

Comments
 (0)