Skip to content

Commit

Permalink
fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
daveey committed Apr 20, 2023
1 parent eddb62b commit dbbcfcd
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 30 deletions.
1 change: 0 additions & 1 deletion nmmo/entity/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,4 +332,3 @@ def attack_level(self) -> int:
mage = self.skills.mage.level.val

return int(max(melee, ranged, mage))

2 changes: 1 addition & 1 deletion nmmo/entity/entity_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def reset(self):
self.spawned = OrderedSet()

def spawn_individual(self, r, c, idx):
pop, agent = next(self.agents)
agent = next(self.agents)
agent = agent(self.config, idx)
player = Player(self.realm, (r, c), agent)
super().spawn(player)
Expand Down
2 changes: 1 addition & 1 deletion nmmo/entity/npc.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

from nmmo.entity import entity
from nmmo.io import action as Action
from nmmo.lib.colors import Neon
from nmmo.systems import combat, droptable
from nmmo.systems.ai import policy
from nmmo.systems import item as Item
Expand Down Expand Up @@ -46,6 +45,7 @@ def packet(self):
return packet


# pylint: disable=no-member
class NPC(entity.Entity):
def __init__(self, realm, pos, iden, name, npc_type):
super().__init__(realm, pos, iden, name)
Expand Down
25 changes: 1 addition & 24 deletions nmmo/lib/spawn.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ class SequentialLoader:
'''config.PLAYER_LOADER that spreads out agent populations'''
def __init__(self, config):
items = config.PLAYERS
for idx, itm in enumerate(items):
itm.policyID = idx

self.items = items
self.idx = -1
Expand All @@ -15,28 +13,7 @@ def __iter__(self):

def __next__(self):
self.idx = (self.idx + 1) % len(self.items)
return self.idx, self.items[self.idx]

class TeamLoader:
'''config.PLAYER_LOADER that loads agent populations adjacent'''
def __init__(self, config):
items = config.PLAYERS
self.team_size = config.PLAYER_N // len(items)

for idx, itm in enumerate(items):
itm.policyID = idx

self.items = items
self.idx = -1

def __iter__(self):
return self

def __next__(self):
self.idx += 1
team_idx = self.idx // self.team_size
return team_idx, self.items[team_idx]

return self.items[self.idx]

def spawn_continuous(config):
'''Generates spawn positions for new agents
Expand Down
6 changes: 3 additions & 3 deletions tests/testhelpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,21 +332,21 @@ def _check_assert_make_action(self, env, atn, test_cond):
self.assertEqual(
cond['ent_mask'],
self._check_ent_mask(ent_obs, atn, cond['tgt_id']),
"ent_id: {}, atn: {}, tgt_id: {}".format(ent_id, atn, cond['tgt_id'])
f"ent_id: {ent_id}, atn: {ent_id}, tgt_id: {cond['tgt_id']}"
)

if atn in [action.Give]:
self.assertEqual(
cond['inv_mask'],
self._check_inv_mask(ent_obs, atn, cond['item_sig']),
"ent_id: {}, atn: {}, item_sig: {}".format(ent_id, atn, cond['item_sig'])
f"ent_id: {ent_id}, atn: {ent_id}, tgt_id: {cond['item_sig']}"
)

if atn in [action.Buy]:
self.assertEqual(
cond['mkt_mask'],
self._check_mkt_mask(ent_obs, cond['item_id']),
"ent_id: {}, atn: {}, item_id: {}".format(ent_id, atn, cond['item_id'])
f"ent_id: {ent_id}, atn: {ent_id}, tgt_id: {cond['item_id']}"
)

# append the actions
Expand Down

0 comments on commit dbbcfcd

Please sign in to comment.