ai-snake-lab 0.4.5__tar.gz → 0.4.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. {ai_snake_lab-0.4.5 → ai_snake_lab-0.4.6}/PKG-INFO +1 -1
  2. {ai_snake_lab-0.4.5 → ai_snake_lab-0.4.6}/ai_snake_lab/game/SnakeGame.py +6 -6
  3. {ai_snake_lab-0.4.5/ai_snake_lab → ai_snake_lab-0.4.6/ai_snake_lab/ui}/AISim.py +5 -1
  4. {ai_snake_lab-0.4.5 → ai_snake_lab-0.4.6}/pyproject.toml +2 -2
  5. {ai_snake_lab-0.4.5 → ai_snake_lab-0.4.6}/LICENSE +0 -0
  6. {ai_snake_lab-0.4.5 → ai_snake_lab-0.4.6}/README.md +0 -0
  7. {ai_snake_lab-0.4.5 → ai_snake_lab-0.4.6}/ai_snake_lab/ai/AIAgent.py +0 -0
  8. {ai_snake_lab-0.4.5 → ai_snake_lab-0.4.6}/ai_snake_lab/ai/AITrainer.py +0 -0
  9. {ai_snake_lab-0.4.5 → ai_snake_lab-0.4.6}/ai_snake_lab/ai/EpsilonAlgo.py +0 -0
  10. {ai_snake_lab-0.4.5 → ai_snake_lab-0.4.6}/ai_snake_lab/ai/ReplayMemory.py +0 -0
  11. {ai_snake_lab-0.4.5 → ai_snake_lab-0.4.6}/ai_snake_lab/ai/models/ModelL.py +0 -0
  12. {ai_snake_lab-0.4.5 → ai_snake_lab-0.4.6}/ai_snake_lab/ai/models/ModelRNN.py +0 -0
  13. {ai_snake_lab-0.4.5 → ai_snake_lab-0.4.6}/ai_snake_lab/constants/DDb4EPlot.py +0 -0
  14. {ai_snake_lab-0.4.5 → ai_snake_lab-0.4.6}/ai_snake_lab/constants/DDef.py +0 -0
  15. {ai_snake_lab-0.4.5 → ai_snake_lab-0.4.6}/ai_snake_lab/constants/DDir.py +0 -0
  16. {ai_snake_lab-0.4.5 → ai_snake_lab-0.4.6}/ai_snake_lab/constants/DEpsilon.py +0 -0
  17. {ai_snake_lab-0.4.5 → ai_snake_lab-0.4.6}/ai_snake_lab/constants/DFields.py +0 -0
  18. {ai_snake_lab-0.4.5 → ai_snake_lab-0.4.6}/ai_snake_lab/constants/DFile.py +0 -0
  19. {ai_snake_lab-0.4.5 → ai_snake_lab-0.4.6}/ai_snake_lab/constants/DLabels.py +0 -0
  20. {ai_snake_lab-0.4.5 → ai_snake_lab-0.4.6}/ai_snake_lab/constants/DLayout.py +0 -0
  21. {ai_snake_lab-0.4.5 → ai_snake_lab-0.4.6}/ai_snake_lab/constants/DModelL.py +0 -0
  22. {ai_snake_lab-0.4.5 → ai_snake_lab-0.4.6}/ai_snake_lab/constants/DModelLRNN.py +0 -0
  23. {ai_snake_lab-0.4.5 → ai_snake_lab-0.4.6}/ai_snake_lab/constants/DReplayMemory.py +0 -0
  24. {ai_snake_lab-0.4.5 → ai_snake_lab-0.4.6}/ai_snake_lab/constants/DSim.py +0 -0
  25. {ai_snake_lab-0.4.5 → ai_snake_lab-0.4.6}/ai_snake_lab/constants/__init__.py +0 -0
  26. {ai_snake_lab-0.4.5 → ai_snake_lab-0.4.6}/ai_snake_lab/game/GameBoard.py +0 -0
  27. {ai_snake_lab-0.4.5 → ai_snake_lab-0.4.6}/ai_snake_lab/game/GameElements.py +0 -0
  28. {ai_snake_lab-0.4.5 → ai_snake_lab-0.4.6}/ai_snake_lab/ui/Db4EPlot.py +0 -0
  29. {ai_snake_lab-0.4.5 → ai_snake_lab-0.4.6}/ai_snake_lab/utils/AISim.tcss +0 -0
  30. {ai_snake_lab-0.4.5 → ai_snake_lab-0.4.6}/ai_snake_lab/utils/ConstGroup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ai-snake-lab
3
- Version: 0.4.5
3
+ Version: 0.4.6
4
4
  Summary: Interactive reinforcement learning sandbox for experimenting with AI agents in a classic Snake Game environment.
5
5
  License: GPL-3.0
6
6
  License-File: LICENSE
@@ -129,12 +129,6 @@ class SnakeGame:
129
129
  game_over = True
130
130
  reward = -10
131
131
 
132
- # Set a negative reward if the snake head is adjacent to the snake body.
133
- # This is to discourage snake collisions.
134
- for segment in self.snake[1:]:
135
- if abs(self.head.x - segment.x) < 2 and abs(self.head.y - segment.y) < 2:
136
- reward -= -1
137
-
138
132
  if game_over == True:
139
133
  # Game is over: Snake or wall collision or exceeded max moves
140
134
  self.game_reward += reward
@@ -159,6 +153,12 @@ class SnakeGame:
159
153
  reward -= 2
160
154
  self.distance_to_food = cur_distance
161
155
 
156
+ ## 6. Set a negative reward if the snake head is adjacent to the snake body.
157
+ # This is to discourage snake collisions.
158
+ for segment in self.snake[1:]:
159
+ if abs(self.head.x - segment.x) < 2 and abs(self.head.y - segment.y) < 2:
160
+ reward -= -2
161
+
162
162
  self.game_reward += reward
163
163
  self.game_board.update_snake(snake=self.snake, direction=self.direction)
164
164
  self.game_board.update_food(food=self.food)
@@ -426,6 +426,10 @@ def minutes_to_uptime(seconds: int):
426
426
  return f"{seconds}s"
427
427
 
428
428
 
429
- if __name__ == "__main__":
429
+ def main():
430
430
  app = AISim()
431
431
  app.run()
432
+
433
+
434
+ if __name__ == "__main__":
435
+ main()
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "ai-snake-lab"
3
- version = "0.4.5"
3
+ version = "0.4.6"
4
4
  description = "Interactive reinforcement learning sandbox for experimenting with AI agents in a classic Snake Game environment."
5
5
  authors = [{ name = "Nadim-Daniel Ghaznavi", email = "nghaznavi@gmail.com" }]
6
6
  license = { text = "GPL-3.0" }
@@ -38,7 +38,7 @@ dependencies = [
38
38
  ]
39
39
 
40
40
  [project.scripts]
41
- ai-snake-lab = "ai_snake_lab.AISim:main"
41
+ ai-snake-lab = "ai_snake_lab.ui.AISim:main"
42
42
 
43
43
  [project.urls]
44
44
  "Bug Tracker" = "https://github.com/NadimGhaznavi/ai_snake_lab/issues"
File without changes
File without changes