Sathvika
Sathvika
ON
Snake Game
Submitted by
G. Sathvika - 23RH1A05Q0
G. Pravalika - 23RH1A05Q1
G.Haritha - 23RH1A05Q2
DECEMBER 2023
This is to certify that this is the bonafied record of the project titled
“SNAKE GAME” submitted by
G.Sathvika (23RH1A05Q0)
G.Pravalika (23RH1A05Q1)
G.Haritha (23RH1A05Q2)
Of First year B. Tech, in the partial fulfillment of the requirements for the degree
of Bachelor of Technology in Electronic and communication Engineering during
the year 2023-2024. The results embodied in this project report have not been
submitted to any other university or institute for the award of any degree or
diploma.
We feel ourselves honored and privileged to place our warm salutation to our college Malla
Reddy Engineering College for Women and department of Electronic and Communication Engineering
which gave us the opportunity to have expertise in engineering and profound technical knowledge.
We would like to convey thanks to our internal project guide Mr.SUNDAR RATNAM for her
regular guidance and constant encouragement and we are extremely grateful to her for her valuable
suggestions and unflinching co-operation throughout project work.
we express our heartiest thanks to Dr. A. SWARUPA RANI, Head of the Department, H&S
for encouraging us in every aspect of our project
We wish to convey gratitude to our Principal Dr. Y. MADHAVEE LATHA, for providing us
with the environment and means to enrich our skills and motivating us in our endeavor and helping us
realize our full potential.
G. Sathvika (23RH1A05Q0)
G. Pravalika (23RH1A05Q1)
G.Haritha(23RH1A05Q2)
ABSTRA
CT
snake game is a computer action game, whose goal is to control a snake to move and collect food
in a map. In this paper we develop a controller based on movement rating function considering
smooth less, space, and food.
Scores given by these functions are aggregated by linear weighted sum, and the snake takes the
action that leads to the highest score. To find a set of good weight values, we apply an
evolutionary algorithm. We examine several algorithm variants of different crossover and
environmental selection operators. Experimental results show that our design method is able to
generate smart controllers.
INDEX
Title Page no
Abstract
1. Introduction 1-2
2. Requirements 3
3. Analysis 4
4. Algorithm 5
5. Flowchart 6
6. Implementation 7
7. Output Screens 8
9. References 10
Introduction:
The game called “snake” or “snake game” typically involve the player controlling a line or
snake, there is no official version of the game, so gameplay varies. The most common version of
the game, involves the snake or line eating items which make it longer, with the objective being
to avoid running into a border or the snake itself for as long as possible.
The player loses when the snake either runs into a border or its own body. Because of this, the
game becomes more difficult as it goes on, due to the growth of the snake.
Nokia has installed the “snake game” on many of its phones. The game is also available on
several websites, including You tube, which allows viewers to play the game while a video
loads.
This snake game is a basic console program with no graphics. Food is placed at various
co-ordinates on the screen for the snake to consume. The snake’s length and score will both rise
by one element each time it consumes the food.
Objectives:
This project in C language of Snake Game is a simple console application with very simple
graphics. In this project, you can play the popular “snake game” just like you played it
elsewhere. You have to use the up, down, right or left arrows to move the snake.
Foods are provided at the several co-ordinates of the screen for the snake to eat. Every
time the snake eats the food, its length will by increased by one element along with the
score.
It isn’t the world’s greatest game, but it does give you an idea of what you can achieve with
a relatively simple c program, and perhaps the basis by which to extend the principles and
create more interesting games of your own.
The aim of the game is to collect the dots and avoid the obstacles, there is no concept of
lives. Once you hit an obstacle, that’s it, game over.
Requirements:
Hardware Requirements:
1. RAM 4GB
2. HARDDISK 1TB
3. PROCESSOR PENTIUM I5
Software Requirements:
Analyzing a snake game in C involves reviewing the code structure, logic, and key
functions.
Initialization:
Game loop:
Continuously take input from the user to change the snake’s direction (up, down, left, right).
Update the snake’s position based on its current directions.
If the snake collides with itself or the game boundaries, end the game.
If the snake reaches the food, increase its length and place a new food item randomly.
Data structures:
Functions:
Algorithm:
Step 1: Initialize game board and snake
Flowchart:
Implementation:
#include<stdio.h>
#include<stdlib.h>
int i, j, height=30;
int width=30, game over, score;
void draw()
{
for(i=0;i<height;i++)
{
for(j=0;j<width;j++)
{
if(i==0||i==width-1||j==0||j==height-1)
{
printf(“#”);
}
else
{
printf(“”);
}
}
printf(“\n”);
}
}
int main()
{
draw();
return 0;
}
Output screens:
Conclusion:
The project in c language of snake game is a simple console application with very simple
graphics. In this project, you can play the popular “snake game” just like you played it
elsewhere. You have to use the up, down, right or left arrows to move the snake.
Foods are provided at the several co-ordinates of the screen for the snake to eat. Every
time the snake eats the food, its length will by increased by one element along with the
score.
It isn’t the world’s greatest game, but it does give you an idea of what you can achieve
with a relatively simple c program, and perhaps the basis by which to extend the
principles and create more interesting games of your own.
Future Enhancements:
Our project will be able to implement in future after making some changes and
modifications as we make our project at a very low level. So the modifications that can be
done in our project are:
https://en.wikipedia.org/wiki
https://www.youtube.com
https://www.cs.bham.ac.uk
Books:
a. Let us C by Yashwant kanetkar
b. Programming with C by E Balagurusamy
c. Graphics under C by Yashwant kanetkar