You are on page 1of 42

Subject name and code: OOP (22316) Academic Year: 2022-23

Couse Name: IF3I Semester: Third

A STUDY ON
DEVELOP SNAKE GAME
MICRO PROJECT REPORT
Submitted in December 2022 by the group of 3 students
Sr. Roll No. Full Name of Students Enrollment Seat No.
No. ( sem-3) No. (semester-3)
1 DSD6 PINIL BABURAV CHAKAR 2209350316 131583
2 DSD12 ROHIT RAJENDRA SONAWANE 2209350328 131595
3 DSD17 SURAJ GURUNATH RAUT 2209350324 131591

Under the Guidance of


PROF. MS. SHWETA CHANCHLANI
In
Diploma Board of Technical Education,
ISO 9001:2008 (ISO/IEC-27001:201
SHIVAJIRAO S. JONDHALE POLYTECHNIC, ASANGOAN
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION,
MUMBAI

CERTIFICATES
AS
This is to certify that Mr. PINIL BABURAV CHAKAR
Roll No: DSD6 of Third Semester of Information Technology Programme in
Engineering & Technology at Shivajirao. S Jondhale Polytechnic Asangaon
(EAST) Shahapur 421601 has completed the Micro Project Satisfactorily in
Subject: OOP
In the academic Year 2022 as prescribed curriculum of I Scheme.

Place: ASANGOAN Enrollment No: 2209350316


Date: / /2022 Exam Seat No: 131583

Project Guide Heat of Department Principal

Seal of
institute
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION,
MUMBAI

CERTIFICATES

This is to certify that Mr. ROHIT RAJENDRA SONAWANE


Roll No: DSD12 of Third Semester of Information Technology Programme in
Engineering & Technology at Shivajirao. S Jondhale Polytechnic Asangaon
(EAST) Shahapur 421601 has completed the Micro Project Satisfactorily in
Subject: OOP
In the academic Year 2022 as prescribed curriculum of I Scheme.

Place: ASANGOAN Enrollment No: 2209350328


Date: / /2022 Exam Seat No: 131595

Project Guide Heat of Department Principal

Seal of
institute
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION,
MUMBAI

CERTIFICATES

This is to certify that Mr. SURAJ GURUNATH RAUT


Roll No: DSD17 of Third Semester of Information Technology Programme in
Engineering & Technology at Shivajirao. S Jondhale Polytechnic Asangaon
(EAST) Shahapur 421601 has completed the Micro Project Satisfactorily in
Subject: OOP
In the academic Year 2022 as prescribed curriculum of I Scheme.

Place: ASANGOAN Enrollment No: 2209350324


Date: / /2022 Exam Seat No: 131591

Project Guide Heat of Department Principal

Seal of
institute
-:Index:-

1) Introduction

2) Abstract

3) Features

4) Program

5) Screenshot

6) Conclusion

7) Reference

-:Introduction:-
Playing games is fun and
exciting. It gives us relief
from stress and unwinds
from our stressful work.
Many of us spend our free
time or others that use
most
of their time in playing
and exploring new games.
Today, with the raped
development of
technology we have,
games that are rising up
together with it.
Nowadays with
technology we have many
games that are developed
for
computers specifically for
windows. With the high
technology equipped with
these computer games
become robust and attract
many people to buy or
have
this gadget for them to
experience what's inside it
which makes it a trend for
the
new generation of gadget.
Snake game is a computer
action game, whose goal
is to control a stake to
move
and collect food in a map.
It has been around since
the earliest days of home
computing and has re-
emerged in recent years
on mobile phones.
It isn't the world's greatest
game, but it does give you
an idea of what you can
achieve with a simple
python program, and
perhaps the basis by
which to
extend the principles and
create more interesting
games on your own. To
move
the snake, use up arrow
for up, down arrow for
down, "left arrow for left
and
right arrow for right. Press
"Q' to exit the game at any
time, press "C" to
continue the game.
The aim of the game is to
collect the dots (food) and
avoid the obstacles (walls,
boundaries). As you
collect the food, the stake
gets longer. The score also
increases. There is no
concept of life. Once you
hit an obstacle, that's it,
game
over.
Playing games is fun and
exciting. It gives us relief
from stress and unwinds
from our stressful work.
Many of us spend our free
time or others that use
most
of their time in playing
and exploring new games.
Today, with the raped
development of
technology we have,
games that are rising up
together with it.
Nowadays with
technology we have many
games that are developed
for
computers specifically for
windows. With the high
technology equipped with
these computer games
become robust and attract
many people to buy or
have
this gadget for them to
experience what's inside it
which makes it a trend for
the
new generation of gadget.
Snake game is a computer
action game, whose goal
is to control a stake to
move
and collect food in a map.
It has been around since
the earliest days of home
computing and has re-
emerged in recent years
on mobile phones.
It isn't the world's greatest
game, but it does give you
an idea of what you can
achieve with a simple
python program, and
perhaps the basis by
which to
extend the principles and
create more interesting
games on your own. To
move
the snake, use up arrow
for up, down arrow for
down, "left arrow for left
and
right arrow for right. Press
"Q' to exit the game at any
time, press "C" to
continue the game.
The aim of the game is to
collect the dots (food) and
avoid the obstacles (walls,
boundaries). As you
collect the food, the stake
gets longer. The score also
increases. There is no
concept of life. Once you
hit an obstacle, that's it,
game
over.
Playing games is fun and
exciting. It gives us relief
from stress and unwinds
from our stressful work.
Many of us spend our free
time or others that use
most
of their time in playing
and exploring new games.
Today, with the raped
development of
technology we have,
games that are rising up
together with it.
Nowadays with
technology we have many
games that are developed
for
computers specifically for
windows. With the high
technology equipped with
these computer games
become robust and attract
many people to buy or
have
this gadget for them to
experience what's inside it
which makes it a trend for
the
new generation of gadget.
Snake game is a computer
action game, whose goal
is to control a stake to
move
and collect food in a map.
It has been around since
the earliest days of home
computing and has re-
emerged in recent years
on mobile phones.
It isn't the world's greatest
game, but it does give you
an idea of what you can
achieve with a simple
python program, and
perhaps the basis by
which to
extend the principles and
create more interesting
games on your own. To
move
the snake, use up arrow
for up, down arrow for
down, "left arrow for left
and
right arrow for right. Press
"Q' to exit the game at any
time, press "C" to
continue the game.
The aim of the game is to
collect the dots (food) and
avoid the obstacles (walls,
boundaries). As you
collect the food, the stake
gets longer. The score also
increases. There is no
concept of life. Once you
hit an obstacle, that's it,
game
over.
Playing games is fun and
exciting. It gives us relief
from stress and unwinds
from our stressful work.
Many of us spend our free
time or others that use
most
of their time in playing
and exploring new games.
Today, with the raped
development of
technology we have,
games that are rising up
together with it.
Nowadays with
technology we have many
games that are developed
for
computers specifically for
windows. With the high
technology equipped with
these computer games
become robust and attract
many people to buy or
have
this gadget for them to
experience what's inside it
which makes it a trend for
the
new generation of gadget.
Snake game is a computer
action game, whose goal
is to control a stake to
move
and collect food in a map.
It has been around since
the earliest days of home
computing and has re-
emerged in recent years
on mobile phones.
It isn't the world's greatest
game, but it does give you
an idea of what you can
achieve with a simple
python program, and
perhaps the basis by
which to
extend the principles and
create more interesting
games on your own. To
move
the snake, use up arrow
for up, down arrow for
down, "left arrow for left
and
right arrow for right. Press
"Q' to exit the game at any
time, press "C" to
continue the game.
The aim of the game is to
collect the dots (food) and
avoid the obstacles (walls,
boundaries). As you
collect the food, the stake
gets longer. The score also
increases. There is no
concept of life. Once you
hit an obstacle, that's it,
game
over.
Playing games is fun and
exciting. It gives us relief
from stress and unwinds
from our stressful work.
Many of us spend our free
time or others that use
most
of their time in playing
and exploring new games.
Today, with the raped
development of
technology we have,
games that are rising up
together with it.
Nowadays with
technology we have many
games that are developed
for
computers specifically for
windows. With the high
technology equipped with
these computer games
become robust and attract
many people to buy or
have
this gadget for them to
experience what's inside it
which makes it a trend for
the
new generation of gadget.
Snake game is a computer
action game, whose goal
is to control a stake to
move
and collect food in a map.
It has been around since
the earliest days of home
computing and has re-
emerged in recent years
on mobile phones.
It isn't the world's greatest
game, but it does give you
an idea of what you can
achieve with a simple
python program, and
perhaps the basis by
which to
extend the principles and
create more interesting
games on your own. To
move
the snake, use up arrow
for up, down arrow for
down, "left arrow for left
and
right arrow for right. Press
"Q' to exit the game at any
time, press "C" to
continue the game.
The aim of the game is to
collect the dots (food) and
avoid the obstacles (walls,
boundaries). As you
collect the food, the stake
gets longer. The score also
increases. There is no
concept of life. Once you
hit an obstacle, that's it,
game
over.
In this article, we will learn to create a snake game using C++ programming
language. The snake game is top-rated among players and is available on all
devices. The game is designed so that the snake can move in every direction,
whether left, right, upward, or downward. The snake moves in search of food.
The score increases as the snake eat the food. The game is quite simple but
exciting while playing.

Snake game is a computer action game, whose goal is to control a stake to


move and collect food in a map. It has been around since the earliest days of
home computing and has re-emerged in recent years on mobile phones.

It isn't the world's greatest game, but it does give you an idea of what you can
It isn't the world's greatest game, but it does give you an idea of what you can
achieve with a simple python program, and perhaps the basis by which to
extend the principles and create more interesting games on your own. To
move he snake, use up arrow for up, down arrow for down, "left arrow for left
and right arrow for right. Press "Q' to exit the game at any time, press "C" to
continue the game.
The aim of the game is to collect the dots (food) and avoid the obstacles (walls,
boundaries). As you collect the food, the stake gets longer. The score also
increases. There is no concept of life. Once you hit an obstacle, that's it, game
over.

Abstract
The Nokia inspired Snake game implemented on 8051 platform. The game is
built on AT89S51. A dedicated delay setting key provides one touch access to
the delay settings mode where the speed of the Snake can be adjusted.

In this we are using switches one is Start for starting of the game and
remaining switches for snake movements left, right, up and down these
switches used like as a buttons in mobile. We are going to develop coding by
using Embedded C according to that coding by using switches the game will be
operate according to our requirement.

Features

 Inhibited only by creativity and available technology


 Use game for skills based trainings.
 Important as learning point of view for children
 Use for understand technology
 Best for Education
 Virtual Reality Gaming (FIFA)
 Augmented Reality
 Motion Capture
 Cloud Gaming
 Quantum Computing and Gaming
 Emerging Trends
 Way of sharing technology

Program
#include<stdio.h>
#include<dos.h>
#include<ctype.h>
#include<string.h>
#include<conio.h>
#include<stdlib.h>
#define TOP 1
#define DOWN 2
#define LEFT 3
#define RIGHT 4
void score(int s=1)
{
static unsigned long sc=0;
window(70,22,78,23);
if(s)
{
sc=sc+100;
cprintf(" ");
window(70,22,78,23);
cprintf("%ld",sc);
}
else
sc=0;
}
void status(char *s,int c=WHITE)
{
window(70,23,78,25);
textcolor(c);
cprintf("%s",s);
for(int x=strlen(s);x<7;x++)
cprintf(" ");
textcolor(WHITE);
}
void main()
{
clrscr();
_setcursortype(_NOCURSOR);
textcolor(WHITE);
cprintf("\n
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
ÄÄÄÄ¿ ");
for(int i=0;i<17;i++)
cprintf(" ³ ³ ");
cprintf("
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
ÄÄÄÄÙ ");
cprintf(" ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ Press 'x' to Exit
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ");
cprintf(" ³ S N A K E G A M E ³ Press 'p' to Pause and Play ³ SCORE : 0 ³ ");
cprintf(" ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ ³ STATUS: Playing ³ ");
cprintf(" ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ ");
int snkx[20],snky[20],d=LEFT,p=0,sz=6,restart=1;
while(1)
{
if(restart)
{
for(i=0;i<6;i++)
snkx[i]=30+i*2;
for(i=6;i<20;i++)
snkx[i]=0;
for(i=0;i<20;i++)
snky[i]=9;
sz=6;
p=0;
d=LEFT;
restart=0;
score();
window(6,3,76,19);
for(i=0;i<610;i++)
cprintf(" ");
}
int x,y;
if(p!=1)
{
randomize();
do{
x=random(70)+6;
}while(x%2==1);
y=random(16)+3;
p=1;
window(x,y,x+1,y+1);
textcolor(LIGHTGREEN);
cprintf("%c",1);
textcolor(WHITE);
}
while(!kbhit())
{
status("Playing",LIGHTGREEN);
window(snkx[sz-1],snky[sz-1],snkx[sz-1]+2,snky[sz-1]+2);
cprintf(" ");
for(i=0;i<sz-1;i++)
{
window(snkx[i],snky[i],snkx[i]+1,snky[i]+1);
cprintf("");
}
for(i=sz-1;i>=1;i--)
{
snkx[i]=snkx[i-1];
snky[i]=snky[i-1];
}
switch(d)
{
case RIGHT : snkx[0]+=2; break;
case LEFT : snkx[0]-=2; break;
case TOP : snky[0]-=1; break;
case DOWN : snky[0]+=1;
}
delay(200);
if(x==snkx[0] && y==snky[0])
{
int f=0;
do{
do{
x=random(70)+6;
}while(x%2==1);
y=random(16)+3;
for(i=0;i<sz;i++)
if(snkx[i]==x && snky[i]==y)
f=1;
}while(f);
p=1;
window(x,y,x+1,y+1);
textcolor(LIGHTGREEN);
cprintf("%c",1);
textcolor(WHITE);

score();
sz++;

switch(d)
{
case RIGHT : snkx[sz-1]+=2;
snky[sz-1]=snky[sz-2];
break;
case LEFT : snkx[sz-1]-=2;
snky[sz-1]=snky[sz-2];
break;
case TOP : snky[sz-1]-=1;
snkx[sz-1]=snkx[sz-2];
break;
case DOWN : snky[sz-1]+=1;
snkx[sz-1]=snkx[sz-2];
}
}
int sflag=0;
for(i=0;i<sz-1;i++)
if(snkx[sz-1]==snkx[i] && snky[sz-1]==snky[i])
{
sflag=1;
break;
}
if(snkx[0]<5 || snkx[0]>76 || snky[0]<3 || snky[0]>19)
sflag=1;
if(sflag)
{
textcolor(LIGHTRED);
for(i=1;i<sz;i++)
{
window(snkx[i],snky[i],snkx[i]+1,snky[i]+1);
cprintf("");
}
status("Stoped",LIGHTRED);
score(0);
restart=1;
break;
}
}
char ch=getch();
switch(tolower(ch))
{
case 'x' : return;
case 'p' :
status("Paused");
getch();
break;
case 0 : {
char chh=getch();
switch(chh)
{
case 72 :{
if(d==LEFT || d== RIGHT)
d=TOP;
} break;
case 80 :{
if(d==LEFT || d== RIGHT)
d=DOWN;
} break;
case 75 :{
if(d==TOP || d==DOWN)
d=LEFT;
} break;
case 77 :{
if(d==TOP || d==DOWN)
d=RIGHT;
}
}
} break;
}
}
} // main

Screenshot
Conclusion
We have completed our knowledge of embedded system design after we
finished the project and obtained more experience of software. Since it was
the first time that we built an embedded system, a lot of problems were
encountered during our work on the project.

For the software par, we test our program by applying embedded C++, and
simulate the game on proteus.

:- reference:-
https://myprojectideas.com/
thank you !!!

You might also like