I built a Double DQN agent that learns to play Snake , and every part of it is written in KingCobra , my programming language: the game, the replay buffer, the neural-network training, the HTTP server and a live web dashboard. It uses only KingCobra's standard library ( std.nn , std.http , std.json and std.system ). There is no Python and there are no external dependencies.
Repo: https://github.com/DivyanshuSinha136/KingCobra-Snake-DQN
The dashboard, captured from the real app: the trained agent playing, what it sees and wants, and how it learned.
The result
Score mean 33.1 (best game 50 ) over 100 greedy games on a 10×10 board
Training about 2 minutes on one CPU core
Agent Double DQN, 3-step returns, Huber loss, gradient clipping, soft target updates, optional prioritized replay
Network 19 → 96 → 96 → 3, 11,523 parameters
Reproducible one seed controls everything, and two runs with the same seed give bit-identical models
The model is small on purpose.…