I trapped AI in Snake game for 24 hours
Can AI learn to play Snake from scratch and beat the entire game? In this video I used neuroevolution — an approach that grows a population of 100 neural networks, which evolve through natural selection. And for the finale, I plugged in a Hamiltonian cycle — a mathematically constructed route that's guaranteed to fill the entire grid. ⏱️ TIMESTAMPS 00:00 — Intro 00:16 — Setup 00:33 — How the AI "sees" the field (24 vision rays) 01:22 — First 10 hours of training 05:09 — 20 hours of training 05:50 — Hamiltonian cycle: how the mathematical guarantee works 06:59 — Final run 09:45 — ENDING: AI fills the entire grid 🛠️ TECH USED • Genetic algorithm with tournament selection and elitism • Feedforward neural network: 24 inputs → 16 neurons (tanh) → 4 outputs • Hamiltonian cycle (boustrophedon) with local shortcuts for the final phase • Custom game simulation in JavaScript ❓ A QUESTION FOR YOU Do you think it would be possible to train an AI to beat the game WITHOUT switching to a Hamiltonian cycle? Drop your ideas in the comments — genuinely curious to hear them. 👍 If you enjoyed it — hit the like button, it actually helps the channel a lot. Subscribe if you want more videos about AI and algorithms. #artificialintelligence #neuralnetworks #neuroevolution #hamiltoniancycle #programming #ai #snakegame #machinelearning #algorithms #coding
![Learning pygame by creating Snake [python tutorial]](https://i.ytimg.com/vi/QFvqStqPCRU/hqdefault.jpg?sqp=-oaymwEjCNACELwBSFryq4qpAxUIARUAAAAAGAElAADIQj0AgKJDeAE=&rs=AOn4CLCOQumSj1LDjt3ZJVcD9DnShoLHiw)
Learning pygame by creating Snake [python tutorial]

AI Learns to Race Hurdles (deep reinforcement learning)

I Forced AI To Learn 4D Movement

The Game You Can't Fail

I Gave 3 Wishes to 6 AIs... You Won't Believe What They Asked For

Let's code a SNAKE GAME in python! 🐍

MIT Explains the 12 Possible Endings for AI

I Made a Game with Intentional Bugs

I Trained an AI to Beat This Absurd World Record

I Forced 10 AIs to play Among Us...(it was crazy)

Animation vs. Coding

I Made a Better Minecraft Movie (Sorry Hollywood)

I Made an Evolution Simulator (with silly little guys)

AI Learns to Play Soccer (and breaks physics)

I forced 2 AIs to play Chess (Gemini vs ChatGPT)

I Let ChatGPT and Claude Build Civilizations in WorldBox

Training AI to Play Pokemon with Reinforcement Learning

Why AI Agents are either the best or worst thing we’ve ever built

But how do AI images and videos actually work? | Guest video by Welch Labs

