100% found this document useful (1 vote)
420 views24 pages

1.1general Introduction: Snake Game

This document provides an overview and documentation of a Snake Game project. It discusses the game's introduction, problem statement, feasibility study, literature review, system configuration, module description, system design, and implementation. The feasibility study evaluates the project's potential for success. The system configuration outlines the hardware and software requirements. The module description explains the key components and architecture of the game.

Uploaded by

Shahnawaz Sheikh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
420 views24 pages

1.1general Introduction: Snake Game

This document provides an overview and documentation of a Snake Game project. It discusses the game's introduction, problem statement, feasibility study, literature review, system configuration, module description, system design, and implementation. The feasibility study evaluates the project's potential for success. The system configuration outlines the hardware and software requirements. The module description explains the key components and architecture of the game.

Uploaded by

Shahnawaz Sheikh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 24

Snake Game USN:1NH18MCA29

CHAPTER 1

1.INTRODUCTION

1.1General Introduction

Project documentation is concerned with describing the delivered software product, in this
case the snake game project. Project documentation includes user documentation which tells
users how to use the software product and system documentation which is principally
intended for further development and understanding. Project

1.2Problem system

The name of the game is “Snake game”. It’s a one type game which can be played in the
same machine. In this game we use four 5,1,0,&3 to control the snake direction. And when
pass any key game start and when the snake hit border the game is over.

1.3Feasibility study

A feasibility study evaluates the project’s potential for success; therefore, perceived
objectivity is an important factor in the credibility of the study for potential investors
and lending institutions. There are five types of feasibility study there are-

1. Technical Feasibility

2. Economic Feasibility

3. Legal Feasibility

4. Operational Feasibility

5. Scheduling Feasibility

Department of MCA, NHCE 2018-2019 1


Snake Game USN:1NH18MCA29

CHAPTER 2

2. REVIEW OF LITERATURE

2.1Review Summary

The Mini Project in C Snake Game is a simple console application without graphics.
In this project, you can play the popular “Snake Game” just like you played it else
where. You have to use the 5,1,3 and 0 to move the Snake.
Food 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.
The source code for Snake Game in C is complete and totally error free. It is compiled in
Code::blocks using gcc compiler. The code is about 180 line source code, another type of
function are used and header file are used.

Department of MCA, NHCE 2018-2019 2


Snake Game USN:1NH18MCA29

CHAPTER 3

3.SYSTEM CONFIGURATION

3.1 Hardware requirements

Hard Disk : 32GB


RAM : 128GB
Processor : Any Pentium version
Monitor : hp
Mouse : DELL
Keyboard : Frontech

3.2 Software requirements

Operating System : WINDOWS10


Application Software : TURBO C++ 2.0
Language : C(Computer graphics)
Documentation tool : Ms-Word2010

Department of MCA, NHCE 2018-2019 3


Snake Game USN:1NH18MCA29

CHAPTER 4

4.MODULE DESCRIPTION
4.1 Module1
1.Game Attributes:-The name of the game is “Snake Game”. It’s a one type game which
can be played in the same machine. In this game we use four 5,1,3 and 0 to control the snake
direction. And when press any key game start and when the snake hit border the game is
over.
2.System Architecture:-System architecture defines the working methodology of the game
and shows the components, their relationships and how they evolve to make the game work.
The system architecture of this particular game can be divided into two parts:
 Game components.
 Game architecture.
2.1 Game Components:-Game Components are behind the scene methods which make up
the game and all the functionalities. The components are mesh together and there are lot of
inter relationships between them. The main components are:
void setup():-The setup function we used for generate the food and snake different co-
ordinate. In this function we used the rand().The rand() create the different co-ordinate.

Department of MCA, NHCE 2018-2019 4


Snake Game USN:1NH18MCA29
void draw():-The draw function is used draw the boundary where snake and food are
generate different co-ordinate.

void input():-The input function is used to control the snake inside the boundary which is
used to draw food. Here food is randomly generated. When the snake eat food they become
grow.

Department of MCA, NHCE 2018-2019 5


Snake Game USN:1NH18MCA29

void makelogic():-In this function the main snake game logic is used.

Department of MCA, NHCE 2018-2019 6


Snake Game USN:1NH18MCA29
int main():-The main function is used control the all function (void setup(),void draw(),void
input(),void makelogic()…etc) the main function is required every program. The program
execution start in this main function.

2.2 Game Architecture:-The Game Architecture is the simplified graphical view of the
game. It shows how the components work and the basic view of the game at action. The
architectural view of the game is very important. Simply it gives an overview of the game
functionality and it makes the game easy to understand.

Department of MCA, NHCE 2018-2019 7


Snake Game USN:1NH18MCA29

START

Enter the main menu of Snake game

Please

any key
to
Start

Play Game Quit

Do you
want to
continue
?

STOP

3.Exit:-The final module is used to come out from the system.

Department of MCA, NHCE 2018-2019 8


Snake Game USN:1NH18MCA29

CHAPTER 5

5.SYSTEM DESIGN

5.1 Data Flow Diagram (DFD):-Data Flow Diagrams originated with Chris Gane and Trish
Sarson in 1997, Who popularized the technique for structured analysis and design. Edward
Yourdon and Tom DeMarco introduced another method in the 1980s which used circles
instead rectangles to denote processes and which became popular.
A data Flow Diagram (DFD) is a graphical representation of the “flow” of data
through an information system, modeling its process aspects. A DFD is often used as a
preliminary step to create an overview of the system without going into great detail, which
can later be elaborated.
It is pictorial representation of Business processes (function/services/activities), along
with the data flow.
 Software process:-Guides how the software is being build.
 Business process:-Specific to organization.

In this focus is on what data flows and not how the data flows. When all the analysis is
being made then we develop a diagram to depict the analysis, and following are being
used:-
SYMBOL MEANING

Process

External Entity

Data Item

Department of MCA, NHCE 2018-2019 9


Snake Game USN:1NH18MCA29
Data Store

DATA FLOW DIAGRAM(DFD):-

0 Level DFD

ADMINISTRATIO

Provides Authentication

GAME

CONSOL

PLAYER

1 Level DFD

User Selection User


process
Select

Request
Give input For input
Output

Working
Process

Department of MCA, NHCE 2018-2019 10


Snake Game USN:1NH18MCA29

CHAPTER 6

6.SYSTEM IMPLEMENTATION
6.1 Implementation:-
6.1.1 Game Construction:-Here we develop the game and test the game and ultimately play
the game. Construction phase can be divided into 2 phase:
 Building the Game
 Game play
6.1.2 Building the Game:-It’s the headrest part in all the line of process. When we first start
the game we first planning, find out the requirements, draw the architecture. To build the
game need to know programming language.
The development phases are:
 Creating a single Snake.
 Creating a Food.
 Snake collision with food.
 Snakes collision with each other body.
 Snakes don’t move two direction at a same time.
6.1.3 Game Play:-The step of game play are given below:-
 Open the game application:

Figure 6.1.2
Department of MCA, NHCE 2018-2019 11
Snake Game USN:1NH18MCA29

Figure 6.1.3

6.2 SCREEN SHOTS:-

Step 1: Welcome Page of the Game

Figure 6.2.1

Department of MCA, NHCE 2018-2019 12


Snake Game USN:1NH18MCA29
This is the Main System. Where we play the game . The operation we want to perform Here
the system contains snake, food, score, boundary where we play game. You have to use the
5,1,2 & 3 to move the snake.

Step2:Algorithm for Increasing Size of Snake and Increasing Score

Figure 6.2.2

random function:-In c program there is a random function which is used to place the food at
any point on the screen. Moving snake in the screen, As you can see snake is printed by
printing ''@'' on the screen. Thus,we need to print the one character at the beginning and
erasing one character at the end.

Changing Direction:-The direction of snake can be changed using kbhit() function .when
you press the character accordingly it will change the direction of the snake.

Increasing size of snake:-When snake moves forward it's size increases and when the
coordinate of snake match with food coordinate then the size of snake is increased.

Increasing score:-when snanke get's the food the score of the user is also increased.

Step 3: Game Over Condition

Department of MCA, NHCE 2018-2019 13


Snake Game USN:1NH18MCA29

Figure 6.2.3

When snake touch the boundary of the screen. The game over will come. This can be done by
comparing the coordinate of boundary with the snake co-ordinate.

Step 7: Quit Page

Figure 6.2.4
Last step ask user if he wants to continue playing or not. suppose we want to continue the
game we press the “y” then press the enter and the game is start.If we want to quit the game
Department of MCA, NHCE 2018-2019 14
Snake Game USN:1NH18MCA29
press any key then press enter.

6.3SAMPLE CODING:-

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
int width=20,hight=20,gameover;
int x,y,fruitx,fruity,score,flag;
int tailx[100],taily[100];
int counttail=0;
void setup()
{
gameover=0;
x=width/2;
y=hight/2;

label1:
fruitx=rand()%20;
if(fruitx==0)
goto label1;
label2:
fruity=rand()%20;
if(fruity==0)
goto label2;
score=0;
}
void draw()
{
int i,j,k;
system("cls");
for(i=0;i<width;i++)

Department of MCA, NHCE 2018-2019 15


Snake Game USN:1NH18MCA29
{
for(j=0;j<hight;j++)
{
if(i==0||i==hight-1||j==0||j==width-1)
{
printf("!");
}
else
{
if(i==x && j==y)
printf("@");
else if(i==fruitx&&j==fruity)
printf("F");
else
{
int ch=0;
for(k=0;k<counttail;k++)
{
if(i==tailx[k] && j==taily[k])
{
printf("*");
ch=1;
}
}
if(ch==0)
printf(" ");
}
}
}
printf("\n");
}
printf("SCORE=%d",score);
}
Department of MCA, NHCE 2018-2019 16
Snake Game USN:1NH18MCA29
void input()
{
if(kbhit())
{
switch(getch())
{
case '1':
flag=1;
break;
case '3':
flag=2;
break;
case '5':
flag=3;
break;
case '0':
flag=4;
break;
case 'x':
gameover=1;
break;
}
}
}
void makelogic()
{
int i;
int prevx=tailx[0];
int prevy=taily[0];
int prev2x,prev2y;
tailx[0]=x;
taily[0]=y;

Department of MCA, NHCE 2018-2019 17


Snake Game USN:1NH18MCA29
for(i=1;i<counttail;i++)
{
prev2x=tailx[i];
prev2y=taily[i];
tailx[i]=prevx;
taily[i]=prevy;
prevx=prev2x;
prevy=prev2y;
}

switch(flag)
{
case 1:
y--;
break;
case 2:
y++;
break;
case 3:
x--;
break;
case 4:
x++;
break;
default:
break;
}
if(x<0||x>width||y<0||y>hight)
gameover=1;
for(i=0;i<counttail;i++)
{
if(x==tailx[i] && y==taily[i])
gameover=1;
Department of MCA, NHCE 2018-2019 18
Snake Game USN:1NH18MCA29
}
if(x==fruitx && y==fruity)
{
label3:
fruitx=rand()%20;
if(fruitx==0)
goto label3;
label4:
fruity=rand()%20;
if(fruity==0)
goto label4;
score+=10;
counttail++;
}
}
int main()
{
int m,n;
char c;
label5:
setup();
while(!gameover)
{
draw();
input();
makelogic();
for(m=0;m<1000;m++)
{
for(n=0;n<1000;n++)
{

}
}
Department of MCA, NHCE 2018-2019 19
Snake Game USN:1NH18MCA29
for(m=0;m<1000;m++)
{
for(n=0;n<1000;n++)
{

}
}
}
printf("\n press y to continue again:");
scanf("%c",&c);
if(c=='y'||c=='Y')
goto label5;
printf("\n 5.FOR UP MOVING");
printf("\n 0.FOR DOWN MOVING");
printf("\n 1.FOR LEFT MOVING");
printf("\n 3.FOR RIGHT MOVING");
return 0;
}

Department of MCA, NHCE 2018-2019 20


Snake Game USN:1NH18MCA29

CHAPTER 7

6. SOFTWARE TESTING

Software testing is process finding error from the program. To make our software error free
it should be done. Until we check the software testing we can‟t say where the error exactly
is, for successfully run the program it must be checked.

Principle of testing:-

i. All the requirements should be checked by customer.


ii. Third party should check the software testing for make if perfect.

iii. Software testing must be done before implementing it.

• Unit testing:-It is the first level of testing. In unit testing smallest part of program
needs to be checked by independently.
• Integration Testing:- It is the second level of testing. In integration testing it‟s find
out the correctness of the program.
• Validation testing:- Validation testing follows integration testing. The distinction
between conventional and object-oriented software disappears. Focuses on user-
visible actions and user-recognizable output from the system. Demonstrates
conformity with requirements.
• Black box testing:-In black box testing we have to check external structure of the
software. You can‟t see the internal structure of the software. If you give input and
based on your input your desirable output come out then it is perfect otherwise
you have to fix it.
• White box testing:-In black box testing we have to check internal structure of the
software. Sometimes it is known by Glass box testing. Every independent path must
be checked at least one time. All loops and boundaries should be checked.
• System testing : -Types of System Testing :

Department of MCA, NHCE 2018-2019 21


Snake Game USN:1NH18MCA29
• Recovery testing: Tests for recovery from system faults. Forces the software to fail
in a variety of ways and verifies that recovery is properly performed. Tests
reinitialization,checkpointing mechanisms, data recovery, and restart for
correctness.
• Security testing: Responsible for protection mechanisms built into a system will and
also protect it from improper access.
• Stress testing: Executes a system in a manner that demands resources in abnormal
quantity, frequency, or volume.
• Performance testing: Tests the run-time performance of software within the context
of an integrated system.

Department of MCA, NHCE 2018-2019 22


Snake Game USN:1NH18MCA29

CHAPTER 8

8. RESULTS AND DISCUSSIONS

8.1Conclusion :-
This project gives us more thrilling, frustrating and also gives us more pleasure. It helps us in
many sectors like- planning, designing, developing, managing, programming skill, socket
programming and so on.

8.2Future Enhancements:-
Our project will be able to implement in future after making some changes and modifications
as we make our project at very low level.So the modifications that can be done in our project
are:IT can be made with good graphics.And we can add more options.

Department of MCA, NHCE 2018-2019 23


Snake Game USN:1NH18MCA29

CHAPTER 9

9.REFERENCES

9.1 TEXT REFERENCE

[1] Roger S. Pressman : Software Engineering – A Practitioners approach, 7 th


Edition, Mc-Graw Hill Education, 2012
[2] E.Balagurusamy : Programming in ANSI C, 7 th Edition, Mc-Graw Hill
Education.
[3] E.Balagurusamy : Data Structures Using C, Mc-Graw Hill Education.

9.2 WEB REFERENCE

[1] http://www.csharpcorner.com/UploadFile/udeshikah/snake
-game-application-in-C-Sharp/
[2] http://www.dreamincode.net/forums/topic/243537-control-

issue-with-snake-game-in-c%23/
[3] http://csharp.netinformations.com/communications/csharp

-chat-client.htm

Department of MCA, NHCE 2018-2019 24

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy