The classic snake game

Snake Game in C

The classic snake game that a lot of us were addicted to playing on our cellphones, made for DOS using C/C++ language with Borland’s Turbo C & graphics.h library

The project started as a hobby project to explore my C/C++ skills and I along with my friends used it as my project for the Computer Graphics course at my university

Originally posted on TechBirbal on Wed, Feb 20, 2008 by me, under my alias ju_s_t4u. Unfortunately, this great site was discontinued by its owner, hence only archived links available

You may need to install DosBox to compile and/or play the game.

Introduction

This is the classic version of the most popular mobile and computer game named “SNAKE”. The main objective of this game is to feed an increasing length of a snake with food particles which are found at random positions, picking up bonus mongooses that occur at regular intervals.

Classic Snake Game

The game starts with selecting one of the three difficulty levels followed by a screen which asks the user to select whether he wishes to play a bounded game or an unbounded game. These concepts are discussed later in the synopsis.

Features Of the Game

  • A very user-friendly game
  • Simple and easy game to understand
  • Explanations provided in the game as and when required
  • 3 different difficulty modes
  • 2 different gaming arenas
  • 3 Chances for each user
  • Presence of bonuses in the game to increase scores
  • Presentations of score card in a precise tabular form

Description

The “snake game” is a game made in C++ language. This is a game which is quite easy to play. The game is a classic representation of the snake game which appears as an inbuilt game feature in most of the leading mobile handsets like Nokia.

The “snake game” is one of the simplest game concepts ever, and just like Tetris it’s very addictive. There are a lot of variations of this game written in Flash, a relatively easy game to code, with an ability that when keys are pressed in rapid succession they are all registered. This is necessary if you want to have full control of the snake at all times.

Your goal is to move the snake and eat as many “food” blocks as possible. There is only one food block at any given time. When the food is eaten, the snake grows in length. If you hit the snake itself the game is over.

Depending on the mode selection, the game modifies itself and hence gives the user choices as he is free to select the difficulty level, the game arena that he can select a bounded or an unbounded region.

Each user gets 3 chances. After the snake consumes a food particle, the score increases. After picking up 15 food particles, a bonus mongoose appears. This Bonus is present only for a limited time. Once the user picks up a bonus, his points increase by 5.

If the user wishes to quit the game anytime, He or she can press the ‘X’ key on the keyboard. This would directly exit the game.

Different modes used in the game

  • Easy mode: Here the box size in which the snake is allowed to move around freely is larger in size as compared to the other two modes. Hence, the user finds it a lot easier to control the snake. Chances for the snake to die are quite less
  • Medium mode: Here the box size in which the snake is allowed to move around freely is larger in size as compared to the hard mode and smaller than in easy mode. Chances for the snake to die are moderate
  • Hard mode: Here the box size in which the snake is allowed to move around freely is smallest. Chances for the snake to die are highest

Different Gaming Arena

  • Unbounded mode: Here, during the process of travelling, if the snake hits the boundary wall, it does not die, instead it comes out from the opposite wall as though there is a continuation in the movement.
  • Bounded mode: Here, during the process of travelling, if the snake hits the boundary wall, the snake dies, and this is counted as a loss of life. This is a tougher mode as compared to the unbounded mode.

Fork it on github


https://github.com/jugalthakkar/snake-c
2 forks.
5 stars.
0 open issues.

Recent commits:

 

 

tincheck.tk – for bulk TIN & CST status check

A trader/entity in India pays value added tax (VAT) while buying goods and services and also collects VAT while selling to the next entity in the supply chain.

Say, the trader bought some goods worth Rs. 10 and if the VAT rate is 10% he would then pay Rs. 11 to the seller including Rs. 1 as VAT. Now the trader sells the goods to another entity for say Rs. 15, he also collects Rs. 1.5 from the buyer in this transaction. Overall the trader paid Rs.1 and collected Rs.1.5 towards VAT. At the end of the day this trader now owes Rs. 0.5 to the government between these two transactions amongst the three entities.

A trader of a decent magnitude would probably have several thousands of transactions a year across hundreds of buyers and sellers. The trader has to periodically (monthly/quarterly/annually) pay the net VAT he owes to the government. At this time he also needs to justify how the net VAT has been reached at. And this is done by a simple balance sheet (J1/J2) stating how much VAT he paid and to whom and how much he collected and from whom. The buyers and sellers are referred to by a unique number called taxpayer identification number or TIN. The government now knows from you, how much VAT you collected, at the same time it also knows from all your sellers how much VAT they collected from you when they submit their accounts.

Mathematically, the sum of all the VAT collected from you from all the sellers would be same as sum of all the VAT you paid to all of them. If either the trader fails to collect the correct TIN of the one of seller or one of the seller fails to provide your correct TIN, this would quickly raise a mismatch and a possible enquiry from the government asking for an explanation to either of the entities.

It’s the traders responsibility to gather and verify the TINs of various entities it transacts with, he may obtain it verbally, through email, sms and any medium he prefers. Obviously this can lead to mistakes. Thankfully the government (of Maharashtra in this instance) has provided a portal to verify and validate TINs @ http://mahavat.gov.in/Tin_Search/Tinsearch.jsp Before submitting their accounts to the government, the trader, or his accountant, has to validate all the TINs in their records. An average 200-300 TINs may be fairly the size for each trader. An accountant may have 20 such clients and hence has to validate thousands of TINs. The portal in it’s current form allows validating on TIN at a time only.

Given the above pretext and the importance of having correct TINs and at the same time validating hundreds or thousands of TINs at once let me to create http://tincheck.tk This came as a request from one of my close relatives who is a Chartered Accountant. I have not hacked the government’s TIN database or gained any access to the same maliciously. The tool provides a bulk input interface to the existing portal of the government and validates one TIN at a time behind the scene like a person would do.