Updated enemy detection
|
@ -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],
|
||||||
|
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 32 KiB |
|
@ -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...")
|
||||||
|
|