Updated enemy detection

This commit is contained in:
Vasilis Valatsos 2023-11-30 18:28:17 +01:00
parent c7ddaa630c
commit bebc660060
8 changed files with 4 additions and 1 deletions

Binary file not shown.

Binary file not shown.

View file

@ -63,6 +63,7 @@ class Player(pygame.sprite.Sprite):
no_load=False): no_load=False):
self.get_current_state() self.get_current_state()
self.num_features ==
self.agent = Agent( self.agent = Agent(
input_dims=len(self.state_features), input_dims=len(self.state_features),
n_actions=len(self._input.possible_actions), n_actions=len(self._input.possible_actions),
@ -173,7 +174,7 @@ class Player(pygame.sprite.Sprite):
enemy_states = [] enemy_states = []
for distance, direction, enemy in sorted_distances[:5]: for distance, direction, enemy in self.distance_direction_from_enemy:
enemy_states.extend([ enemy_states.extend([
np.exp(-distance), np.exp(-distance),
direction[0], direction[0],

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View file

@ -223,6 +223,8 @@ if __name__ == "__main__":
print(f"\nScore this round for player {player.player_id}:\ print(f"\nScore this round for player {player.player_id}:\
{player.stats.exp}") {player.stats.exp}")
# End of training session # End of training session
print("End of episodes.\ print("End of episodes.\
\nExiting game...") \nExiting game...")