Design a Snake Game

Introduction to low level design and design a Snake Game

Category: Low Level Design Tags: C#

Snake Game Code Files and Ppt


    In many companies these days one round of interview is dedicated to low level design. Candidate is given with a design problem where he is asked to design a set of feature of some product like Snake Game, Instagram, What's App and user is supposed to create object oriented design of the project which includes required classes, interfaces, unit tests and many more. You are also supposed to apply design patterns and SOLID principals.

How to approach the problem?

    We have identified 6 points you should follow in interview to solve a design problem are following:

  1. Ask questions for details: Interviewer is the best person who can feed in more details, ask right questions and gather as much information as required.
  2. List important Entities: List important entities in that design, suppose for a snake game Snake and Board are important entities.
  3. Data Structures to use: Decide what data structures should be used for those entities, for Snake a linked list should be good and board should be represented by a matrix.
  4. Think of Logic: Once you know the entities and data structures for them then you can start thinking of logic. Suppose for sake game how would you move snake on the board, how the board will be displayed etc.
  5. Any Design Patterns can be applied? Any design patterns come in your mind you can apply to make it better manageable. If yes then think of making use of it else move on.
  6. Unit test cases: Think about unit tests but you can do it once you have completed the code and if any time is left you can discuss about unit tests with interviewer.

Snake Game

    You must have played snake game in old Nokia phones where snake moves within a window and grows in size once consumes the food.

Snake Game
Fig 1: Snake Game

Below is the full video of Designing a Snake Game


Like 0 People
Last modified on 19 March 2022
Nikhil Joshi

Nikhil Joshi
Ceo & Founder at Dotnetlovers
Atricles: 164
Questions: 16
Given Best Solutions: 16 *


No Comments Yet

You are not loggedin, please login or signup to add comments:

Existing User

Login via:

New User