0% found this document useful (0 votes)
9 views19 pages

Snake Game Project Report in CG

CGR project bouncing ball Simple
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views19 pages

Snake Game Project Report in CG

CGR project bouncing ball Simple
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Page |1

Shriram Shikshan Sanstha’s

Shriram Institute of Engineering & Technology

(Polytechnic), Paniv.

Instt. Code: 0994


A
Project Report
On

_____________________________________________________________________________________

"SNAKE GAME USING COMPUTER GRAPHICS"

Under the guidance of


MS. KADAM. S. D
Page |2

Shriram Shikshan Sanstha’s


Shriram Institute of Engineering & Technology
(Polytechnic), Paniv
CERTIFICATE

[Link] Roll No Student Name

1 2416 KUMBHAR NEHA NITIN

2 2417 KAMBLE PRATIMA AJAY

3 2418 KALE SHARVARI

Student of second year computer technology have completed


Page |3

in the fulfillment of diploma in computer technology of

Maharashtra state board of technical education Mumbai


During academic year 2024- 25

" SNAKE GAME USING COMPUTER GRAPHICS "

MS. KADAM.S.D [Link].S.A


(Project guide) ([Link])

PROF. KHANDARE P.P


(Principal)
Page |4

INDEX

[Link] TITLE PAGE NO

1 INTRODUCTION 6-7

2 ADVANTAGE 8

3 DISADVANTAGE 9-10

4 PROGRAM 11-13

5 CONCLUSION 14

6 REFERENCE 15

ACKNOWLEDGMENT
Page |5

We gratefully acknowledge for the assistance, co-operation


guidance and clarification provided by PROF. KHANDARE P.P.
Principal of SIET, Paniv. Our extreme gratitude are reserved to
Ms. EKTPURE .S.A Head of department of computer
technology.

Ms. KADAM.S. D An our project guidance for their inspiring &


flinhing guidance throughout the course encouragement, great
interest, parental care& support without which the work would
not have taken place. We wish to express our sincere thanks to
all teachers & lab assistants

Our special thanks & gratitude’s are reserved to our friends&


classmates for their constant co-operation, oral support &
appreciation
Page |6

INTRODUCTION

The Snake Game is a classic arcade game where players


control a snake that grows longer as it consumes food
while avoiding collisions with walls and itself. This
implementation uses computer graphics concepts to
create an interactive and visually appealing version of the
game.

1.1 The game utilizes fundamental computer


graphics principles including:

 2D rendering
 Collision detection
 Real-time animation
 User input handling
 Basic geometric primitives
1.2 Key components:
 Snake representation using connected segments
 Food generation at random positions
 Game board boundaries
 Score tracking system
 Graphics rendering engine
1.2 Project Overview
 Implementation using computer graphics principles
 Real-time gameplay mechanics
Page |7

 Score-based gaming system

1.3 Technical Components


 2D rendering
 Collision detection
 Real-time animation
 User input handling
 Basic geometric primitives
1.4 Core Features
 Snake representation using connected segments
 Food generation at random positions
 Game board boundaries
 Score tracking system
 Graphics rendering engine

Advantages
1. Educational Benefits
 Practical application of programming concepts
 Understanding of computer graphics fundamentals
Page |8

 Experience in game development principles


 Learning collision detection algorithms

2. Technical Benefits
 Simple to implement
 Low resource requirements
 Cross-platform compatibility
 Easily modifiable codebase

3. Gaming Experience
 Engaging gameplay mechanics
 Quick learning curve
 Replay ability factor
 Score-based competition

Disadvantages

1. Technical Limitations
 Basic graphics quality
 Limited animation capabilities
Page |9

 Simple collision detection


 Fixed game board size
2. Gameplay Constraints
 Repetitive gameplay
 Limited features compared to modern games
 Basic user interface
 Fixed difficulty level
3. Development Challenges
 Limited graphical customization
 Basic sound implementation
 Platform dependencies
 Performance optimization needs

PROGRAM

#include <graphics.h>
#include <stdlib.h>
#include <dos.h>
#include <conio.h>
#include <stdio.h>
P a g e | 10

#include <time.h>

#define UP 72
#define DOWN 80
#define LEFT 75
#define RIGHT 77

int length;
int bend_no;
int len;
char key;
void record();
void load();
void Delay(long double);
void Move();
void Food();
void Print();
void Bend();
void Boarder();
void Down();
void Left();
void Up();
void Right();
P a g e | 11

void ExitGame();
int Score();
int life;

struct coordinate
{
int x;
int y;
int direction;
};

typedef struct coordinate coordinate;


coordinate head, bend[500], food, body[30];

int main()
{
char key;
Print();
system("cls");
load();
length = 5;
head.x = 25;
head.y = 25;
P a g e | 12

[Link] = RIGHT;
Boarder();
Food();
life = 3;
bend[0] = head;
Move();
return 0;
}

void Move()
{
int a, i;
do
{
Food();
fflush(stdin);
len = 0;
for(i = 0; i < 30; i++)
{
body[i].x = 0;
body[i].y = 0;
if(i == length)
break;
P a g e | 13

}
Delay(length);
Boarder();
if([Link] == RIGHT)
Right();
else if([Link] == LEFT)
Left();
else if([Link] == DOWN)
Down();
else if([Link] == UP)
Up();
ExitGame();
}
while(!kbhit());
a = getch();
if(a == 27)
{
system("cls");
exit(0);
}
key = getch();
if((key == RIGHT && [Link] != LEFT &&
[Link] != RIGHT) ||
P a g e | 14

(key == LEFT && [Link] != RIGHT &&


[Link] != LEFT) ||
(key == UP && [Link] != DOWN &&
[Link] != UP) ||
(key == DOWN && [Link] != UP &&
[Link] != DOWN))
{
bend_no++;
bend[bend_no] = head;
[Link] = key;
if(key == UP)
head.y--;
if(key == DOWN)
head.y++;
if(key == RIGHT)
head.x++;
if(key == LEFT)
head.x--;
Move();
}
else
{
Move();
}
P a g e | 15

GAME OUTPUT

 Drawing the Game Border

+---------------------+
2| |
3| |
4| |
5| |
6| |
8+---------------------+
 Snake Initialization

+---------------------+
2 |

3| |

4| OOOOO | <-- Snake (O)

5| |

6| |
P a g e | 16

7| |

8 +---------------------+
 Food Generation
+---------------------+
2| |
3| |
4| OOOOO | <-- Snake (O)
5| * | <-- Food (*)
6| |
7| |
8+---------------------+

 Collision Detection

Game Over!

Your Score: 10
P a g e | 17

CONCLUSION

1. Project Achievement The Snake Game


implementation successfully demonstrates:

 Core game mechanics implementation


 Basic graphics rendering
 User interaction handling
 Score tracking
 Collision detection
2. Learning Outcomes

 Understanding of computer graphics principles


 Game development fundamentals
 Programming best practices
 User interface design
3. Future Enhancements

 Enhanced graphics capabilities


P a g e | 18

 Multiple difficulty levels


 Power-ups and special effects
 Multiplayer functionality
 Sound effects and background music

REFERENCE
P a g e | 19

 Computer Graphics Principles and Practice, 3rd


Edition Hughes, John F. Addison-Wesley Professional,
2013
 Introduction to Computer Graphics Eck, David J.
Hobart and William Smith Colleges, 2018
 Game Programming Patterns Nystrom, Robert
Genever Benning, 2014
 Graphics Programming Black Book Abrash,
Michael Coriolis Group Books, 1997
 Computer Graphics with OpenGL, 4th Edition
Hearn, Donald & Baker, M. Pauline Pearson,
2010

You might also like