File size: 1,623 Bytes
badef9a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
---
language: en
tags:
- pygame
- reinforcement-learning
- dqn
- game-ai
license: mit
datasets:
- custom
metrics:
- accuracy
- reward
---


# Big Ball Game AI

This model is a Deep Q-Network (DQN) agent trained to play "Big Ball Swallows Small Ball", a dynamic arcade-style game where the goal is to eat smaller balls while avoiding larger ones.

## Model Description

- **Input**: Game state vector (69 dimensions) containing:
  - Player position (x,y)
  - Player size
  - Hunger meter
  - Nearest 13 food items' information (position, size, distance, edibility)

- **Architecture**: 
  - Dueling DQN with Noisy Linear layers
  - Feature extraction: 2 fully connected layers (256 units each)
  - Value stream: 2 noisy linear layers (128 -> 1)
  - Advantage stream: 2 noisy linear layers (128 -> action_space)

## Training

- **Framework**: PyTorch 2.5.1
- **Training Data**: Generated through gameplay (~2000 episodes)
- **Infrastructure**: CUDA-enabled GPU
- **Training Time**: ~4 hours

### Training Parameters

```yaml
episodes: 2000
max_steps: 1500
batch_size: 64
target_update: 100
gamma: 0.99
initial_epsilon: 1.0
final_epsilon: 0.01
```

## Performance

The model achieves:

* Average score: ~3000 points
* Win rate: ~40%
* Average survival time: 800 steps

## Limitations

* May get stuck in local optima (circular patterns)
* Performance degrades with very large numbers of food items
* Can be overly cautious with larger food items

## Useage

Visit [Github Repo](https://github.com/me0w00f/Big-Ball-Swallows-Small-Ball)

# License
This model is released under the MIT License. See the LICENSE file for details.