Design a Snake Game
Design the classic snake game. Include a board with the snake, food placement, movement with direction changes, collision detection (walls and self), scoring, and game-over logic.
Suggested time: 45 minutes
Loading the workspace...
About this problem
A snake game seems trivially simple: move, eat, grow, die. But underneath, the system must handle input from a separate thread without corrupting game state, detect collisions in O(1) using a HashSet, manage a game loop with state transitions, and support extensible food types. Let's break this down.
What your design needs to cover
Directional Movement
Eat Food and Grow
Collision Detection and Game Over
Score Tracking
Key challenges the editorial covers
Learn from other designs
Related problems
Design a Learning Management System (medium)
Design a Blackjack Game (medium)
Design a Warehouse Inventory Tracker (medium)
Design an Airline Booking System (medium)
Design an IoT Smart Home System (medium)
Design a Workout Planner (medium)