Metadata-Version: 2.1
Name: snake_environment
Version: 0.3.0
Summary: A simple snake environment with 18 states and 4 actions
Author-email: LPengulin <contact@pengulin.com>
Project-URL: Homepage, https://github.com/LPengulin/Python_snake_environment
Project-URL: Issues, https://github.com/LPengulin/Python_snake_environment/issues
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy
Requires-Dist: pygame

# Snake Environment

The Snake Environment is a Python package designed for training machine learning models using reinforcement learning techniques. This environment mimics the OpenAI Gym interface, providing a familiar setup for those who are accustomed to using Gym for developing and testing AI models.

## Features

- **Game Environment**: Built using Pygame, this environment allows for on-screen rendering of the snake game, which is useful for visual feedback while training models.
- **Compatibility with AI Training Workflows**: The `SnakeGame` class features a `step` function that returns a tuple of (state, done, reward, score), similar to environments found in OpenAI Gym.
- **State Representation**: The state is represented as a numpy array with 18 dimensions, providing comprehensive information about the game environment at any given step.
- **Utility Methods**: Includes `reset` and `state_dimensions` methods for resetting the game state and retrieving the dimensions of the state space, respectively.

## Installation

To install the Snake Environment, you can use pip:

```bash
pip install snake_environment
```

## Example Usage
```python
from snake_environment import SnakeGame

# Initialize the environment
env = SnakeGame(render=True)  # Set render=False if you do not need to visualize the training process

# Start a new episode
state = env.reset()

# Loop until the episode is finished
done = False
while not done:
    action = model.predict(state) 
    next_state, done, reward, score = env.step(action)
    state = next_state

# Get the dimensions of the state for input layer configuration or debugging
state_dim = env.state_dimensions
print("State dimensions:", state_dim)

```

## Contributions
Contributions are welcome! If you'd like to improve the Snake Environment, please fork this repository and submit a pull request with your proposed changes.

## License
This project is licensed under the MIT License - see the LICENSE file for details.
