mirror of
https://github.com/csd4ni3l/fleet-commander.git
synced 2026-01-01 04:23:47 +01:00
Add model training with graphs and current stats, improve model with better rewarding system
This commit is contained in:
@@ -34,7 +34,7 @@ class Game(arcade.gui.UIView):
|
||||
def on_show_view(self):
|
||||
super().on_show_view()
|
||||
|
||||
self.back_button = self.anchor.add(arcade.gui.UITextureButton(texture=button_texture, texture_hovered=button_hovered_texture, text='<--', style=button_style, width=100, height=50), anchor_x="left", anchor_y="top")
|
||||
self.back_button = self.anchor.add(arcade.gui.UITextureButton(texture=button_texture, texture_hovered=button_hovered_texture, text='<--', style=button_style, width=100, height=50), anchor_x="left", anchor_y="top", align_x=5, align_y=-5)
|
||||
self.back_button.on_click = lambda event: self.main_exit()
|
||||
|
||||
def main_exit(self):
|
||||
|
||||
@@ -33,7 +33,7 @@ class Player(arcade.Sprite): # Not actually the player
|
||||
|
||||
def update(self, model: PPO, enemies, bullets, width, height):
|
||||
if enemies:
|
||||
nearest_enemy = min(enemies, key=lambda e: abs(e.center_y - self.center_y) + abs(e.center_x - self.center_x))
|
||||
nearest_enemy = min(enemies, key=lambda e: abs(e.center_x - self.center_x))
|
||||
enemy_x = (nearest_enemy.center_x - self.center_x) / width
|
||||
enemy_y = (nearest_enemy.center_y - self.center_y) / height
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user