{"id":22085488,"url":"https://github.com/d4niee/deepqlearning-snakegame","last_synced_at":"2026-04-28T22:35:43.406Z","repository":{"id":199059486,"uuid":"658008103","full_name":"d4niee/DeepQLearning-SnakeGame","owner":"d4niee","description":"This project implements an AI that learns the Snake game through Deep Q-Learning. It uses Fast Forward and CNN-based training to learn the optimal game strategy and visualises the learning process.","archived":false,"fork":false,"pushed_at":"2023-10-08T11:59:24.000Z","size":1483,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-23T21:47:12.424Z","etag":null,"topics":["ai","artificial-intelligence","atari","cnn","deep-learning","deep-q-learning","deepmind","dqn","dqn-pytorch","fast-forward","matplotlib","neural-network","python","pytorch","retro","snake","snake-game"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/d4niee.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-06-24T13:33:26.000Z","updated_at":"2023-10-08T11:58:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"300f8390-fc84-4cd5-add2-ab983704e056","html_url":"https://github.com/d4niee/DeepQLearning-SnakeGame","commit_stats":null,"previous_names":["d4niee/deepqlearning-snakegame"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/d4niee/DeepQLearning-SnakeGame","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d4niee%2FDeepQLearning-SnakeGame","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d4niee%2FDeepQLearning-SnakeGame/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d4niee%2FDeepQLearning-SnakeGame/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d4niee%2FDeepQLearning-SnakeGame/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/d4niee","download_url":"https://codeload.github.com/d4niee/DeepQLearning-SnakeGame/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d4niee%2FDeepQLearning-SnakeGame/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32402672,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T19:38:08.556Z","status":"ssl_error","status_checked_at":"2026-04-28T19:37:55.688Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","artificial-intelligence","atari","cnn","deep-learning","deep-q-learning","deepmind","dqn","dqn-pytorch","fast-forward","matplotlib","neural-network","python","pytorch","retro","snake","snake-game"],"created_at":"2024-12-01T01:14:39.135Z","updated_at":"2026-04-28T22:35:43.370Z","avatar_url":"https://github.com/d4niee.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Install Repo\n\n1. Clone the repo.\n2. Navigate to the folder.\n3. Install poetry: pip install poetry\n4. Enter \"poetry install\" in the powershell\n5. \"poetry shell\"\n\n## Add new library\npoetry add name\n\n## Components DQN\n\n``Agent_DQN``: This is the main class representing the DQN agent. It contains methods for storing and retrieving experiences (memory), performing actions based on the current state (get_greedy_action), training the model with stored experiences (train_long_term_memory) and performing a training step based on the current experience (train_short_term_memory). It also contains a method to perform training sessions (training) and to play the game with the trained model (play).\n\n``DQN``: This is the class that represents the DQN model. It is a Convolutional Neural Network (CNN) consisting of three Convolutional Layers and two Fully Connected Layers. The forward method performs a forward traversal through the network. There are also methods to initialise the weights of the model (weights_init), to save the model (save) and to load a saved model (load).\n\n``SnakeGameAI``: This is the class that represents the Snake game. It contains methods to initialise the game (init), reset the game (reset), place food (place_food), perform a move (play_step), check if a collision has occurred (is_collision), and update the user interface (_update_ui).\n\n``DQN_Trainer``: This is the class that manages the training of the DQN model. It contains a method to perform a training step (train_step) where the weights of the model are updated to minimise the difference between the predicted and target Q values.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd4niee%2Fdeepqlearning-snakegame","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fd4niee%2Fdeepqlearning-snakegame","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd4niee%2Fdeepqlearning-snakegame/lists"}