Snake game in C language using queue

Requirments: Turbo C++ compiler

If you face any graphics error ,follow these steps.

  1. Go to “BGI” folder. ( C:\TurboC++\Disk\TurboC3\BGI).
  2. Copy file “EGAVGA.BGI” 
  3. Got “BIN” folder. ( C:\TurboC++\Disk\TurboC3\BIN).
  4. Paste “EGAVGA.BGI” file .
  5. Close Turbo C++ and open it again and run program.

How snake game works?:

  1. Initialize the snake by inserting 4 nodes in queue
  2. Print the queue, these 4 nodes will create snake
  3. To move the snake, add new node in front of head and delete node from tail
  4. clear screen and redraw the screen
  5. This will create illusion of moving snake
  6. If snake hits the food then add extra node in queue
  7. if snake hits the wall or himself then end the game

Download .C file-> SNAKE ( Right click & Save link As). Copy paste code on your local machine

About Gaurav Vichare

Hi , I am Gaurav : author of this blog , Software engineer and a Photoshop lover . You can connect me on LinkedIn, cirlce me on Google or follow on Twitter