🔸AI Snake Game In Python With Q-Learning : Train an AI to Play! 🔸
Recently, I have been experimenting with Reinforcement Learning and tried to use Q-learning to teach my AI how play the famous Snake game. The agent was then trained on this for 12,000 episodes to learn everything from how to move through the grid, find food and eat it, and grow while avoiding running into itself.
↗ What is Q-Learning?
Q-Learning is a Reinforcement Learning technique in which an agent learns to take optimal decisions by interacting with an environment. The agent learns through trial and error, a method that involves storing the value of actions in given states using a Q-table. Whenever the agent can take a move, it will do so in such a way that its rewards are maximized. The agent starts by taking tentative random moves, and gradually learns which actions lead to higher rewards!
↗ Crucial Elements of This Project:
▪ The AI snake underwent 12,000 iterations in order to determine the best course of action.
▪ It moved erratically at first, figuring out how to get to the food to get the most rewards.
▪ As the AI grew and learned to avoid collisions, its motions became increasingly strategic until it eventually reached a target length of at least 5 points!
It's amazing to watch how the AI picks up new skills and adapts through reinforcement. This project was an excellent method to observe the application of Q-learning, a potent method for teaching agents to make decisions!
Watch the video to observe the evolution of the AI snake as it learned!
There are no datasets linked
There are no datasets linked