To run this project, ensure Python 3.10 or later is installed. Follow the steps below to set up the environment:
git clone https://github.com/dAiv-CNU/dAiv.AI-Lecture.DQN dqn
cd dqn
pip install --upgrade uv
uv sync
For NVIDIA GPUs (CUDA versions):
CUDA 11.8
uv add torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 --frozen
CUDA 12.1
uv add torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121 --frozen
CUDA 12.4
uv add torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124 --frozen
using Mac or Window cpu environment
uv add torch torchvision torchaudio
Run the playable snake game:
python -m snakegame normal
Use genetic algorithms to evolve the snake:
python -m snakegame genetic
Run the DQN-based snake AI:
python -m snakegame dqn
Snake game code by HonzaKral: https://gist.github.com/HonzaKral/833ee2b30231c53ec78e