A classic Snake Game built from scratch using Core Java (Swing & AWT). The goal of this project is to understand game loops, rendering, and event handling without using any external game engine.
- Smooth Controls: Lag-free snake movement using KeyAdapter.
- Dynamic Speed Control:
- Press
1: Slow Speed - Press
2: Normal Speed - Press
3: Fast Speed ⚡
- Press
- Restart Mechanism: Press
SPACEto restart instantly after Game Over. - Score System: Real-time score tracking.
- Smart Rendering: Custom
paintComponentrendering for smooth graphics.
- Language: Java (JDK 17+)
- GUI: Swing & AWT (JPanel, JFrame, Graphics)
- Logic: OOPs, Multithreading (Timer), 2D Arrays, Event Handling
We successfully completed the project in 2 Days!
- Day 1: Project Setup (JFrame, JPanel) & Grid Logic
- Day 2: Snake Body & Movement Logic
- Day 2: Food Generation & Collision Detection
- Day 2: Score System & Game Over Screen
- Day 2 (Bonus): Added Restart Functionality & Speed Controls

- Clone this repository.
- Open the folder in VS Code or IntelliJ IDEA.
- Run the
Main.javafile. - Controls:
- Arrow Keys to Move.
1,2,3to change speed.SPACEto Restart.
Bablu Kumar - Aspiring Backend Developer