0% found this document useful (0 votes)
40 views16 pages

Cgrmic

This micro project report describes the development of a Snake Game. The project aims to improve graphics and programming skills. The team distributed tasks - one member worked on the program, another on the interface, another solved errors, and another finalized the design. The code for the Snake Game is presented, which uses functions to generate random fruit locations, draw boundaries, get input, and check for collisions or eating fruit to end the game or increase the snake length respectively. The project achieves course outcomes of manipulating visual graphics and implementing standard algorithms using C programming.

Uploaded by

TAJANE
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)
40 views16 pages

Cgrmic

This micro project report describes the development of a Snake Game. The project aims to improve graphics and programming skills. The team distributed tasks - one member worked on the program, another on the interface, another solved errors, and another finalized the design. The code for the Snake Game is presented, which uses functions to generate random fruit locations, draw boundaries, get input, and check for collisions or eating fruit to end the game or increase the snake length respectively. The project achieves course outcomes of manipulating visual graphics and implementing standard algorithms using C programming.

Uploaded by

TAJANE
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
You are on page 1/ 16

A

Micro Project Report


On

“Snake Game”

Submitte
d by Rugved
Tajane
Aditya Borse
Vishwajeet
Suryawanshi
Vaibhav Rathore

Under the Guidance of


Prof.R.C.Mahajan
In the Partial Fulfilment of Third Semester of Diploma
in Computer Engineering

Department of Computer
Engineering Sandip Polytechnic
Mahiravani,
Nashik - 422213

Affiliated to

Maharashtra State
Board of Technical Education

Academic Year 2022-23


Maharashtra State
Board of Technical Education

Certificate
This is to certify that Mr .Rugved Vijay Tajane of Student with Roll No-28 has successfully completed Micro-
project in course computer Graphics(22318) for the academic year 2022-23 as prescribed in the 'Assessment
Manual' during his/her tenure of completing Third Semester of Diploma Program in Computer Engineering from
institute, Sandip Polytechnic with institute code 1167.

Place : Nashik Enrollment No:

Date: Exam Seat No:

Course Teacher Head of the Department Head of the Institute


Maharashtra State
Board of Technical Education

Certificate
This is to certify that Mr Aditya Sharad Borse of Student with Roll No-05 has successfully completed Micro-
project in course computer Graphics(22318) for the academic year 2022-23 as prescribed in the 'Assessment
Manual' during his/her tenure of completing Third Semester of Diploma Program in Computer Engineering from
institute, Sandip Polytechnic with institute code 1167.

Place : Nashik Enrollment No:

Date: Exam Seat No:

Course Teacher Head of the Department Head of the Institute


Maharashtra State
Board of Technical Education

Certificate
This is to certify that Mr .Vishwajeet Nitin Suryawanshi of Student with Roll No-48 has successfully completed
Microproject in course computer Graphics(22318) for the academic year 2022-23 as prescribed in the
'Assessment Manual' during his/her tenure of completing Third Semester of Diploma Program in Computer
Engineering from institute, Sandip Polytechnic with institute code 1167.

Place : Nashik Enrollment No:

Date: Exam Seat No:

Course Teacher Head of the Department Head of the Institute


Maharashtra State
Board of Technical Education

Certificate
This is to certify that Mr. Vaibhav Anil Rathore of Student with Roll No-44 has successfully completed Micro-
project in course computer Graphics(22318) for the academic year 2022-23 as prescribed in the 'Assessment
Manual' during his/her tenure of completing Third Semester of Diploma Program in Computer Engineering from
institute, Sandip Polytechnic with institute code 1167.

Place : Nashik Enrollment No:

Date: Exam Seat No:

Course Teacher Head of the Department Head of the Institute


Annexure – I

Micro Project Proposal


“Snake Game”

1.0 Aims/Benefits of the Micro-Project:


1 To learn programming in
graphics. 2 To learn about data
structure.
3 To learn about basic operation.
4 To learn about graphic
algorithms. 5 To learn about other
header file.
2.0 Course Outcomes Addressed:
1. Manipulate visual and geometric information of images .
2. Implement standard algorithms to draw various graphics objects using C program .
3.0 Proposed Methodology:
First we formed our group then discussed over the topic. After doing research we finalized our
topic Snake game.Then we distributed our work among four of us. Rugved worked on the
program of the project, Vishwajeet worked on interface of the system, Aditya analyzed and
solved the errors and Vaibhav finalized design and flow of implementation.Similarly we created
our report.

4.0 Action Plan:

Sr. Planned Planned Name of Responsible


No Details of Activity Start Date Finish Date Team Members
1 Topic Discussion & Selection

2 Aim/Benefits & Importance

3 Resources Required
1. Rugved Tajane
4 Analysis of Collected Data 2. Aditya Borse
5 Design & Editing of data 3. Vishwajeet Suryawanshi
4. Vaibhav Rathore
6 Compilation of Report

7 Compilation of Presentation
8 Presentation of Seminar
9 Final Submission

5.0 Resources Required:

SrNo Name of Resource/Material Specification Qty. Remarks


1 Hardware Resource Intel i3,2GB RAM 1 -
2 Software Resource Turbo C/C++ 1 -
3 Any Other Resource Internet 1 -

Name of Team Members with Roll No:

Roll No Name of Team Members

28. 1.Rugved Tajane

05. 2. Aditya Borse

48. 3.Vishwajeet Suryawanshi

44. 4.Vaibhav Rathore

Name & Signature of Course


Teacher (Prof.R.C.Mahajan)
Annexure – II

Micro Project Report


Rationale (Purpose of the project):
1) To improve the graphics
skills. 2)To improve accuracy.
3) To learn programming.

Aims/Benefits of the Micro-Project:


1.To learn programming in
graphics. 2.To learn about data
structure.
3.To learn about basic operation.
4.To learn about graphic
algorithms. 5.To learn about other
header file.

Course Outcomes Achieved:


1. Manipulate visual and geometric information of images
2. Implement standard algorithms to draw various graphics objects using C program

3.0 Literature Review:

This project is inspired from websites like code with C.com,studytonight.com We used the some
new header file to design the pendulum clock.

4.0Actual Methodology Followed:

First we formed our group then discussed over the topic. After doing research we finalized our topic
Snake game.Then we distributed our work among four of us. Rugved worked on the program of the
project, Vishwajeet worked on interface of the system, Aditya analyzed and solved the errors and
Vaibhav finalized design and flow of implementation.Similarly we created our report

Algorithm:
• Create a game board with a width and height of 20.
• Create a snake with a length of 3 and a head position of (10, 10).
• Create a fruit with a random position on the game board.
• Get user input for the direction of the snake's movement.
• Move the snake in the direction of the user input.
• Check if the snake has eaten the fruit. If it has, increase the snake's length and create a new fruit.
• Check if the snake has hit the wall or its own tail. If it has, end the game.
• Repeat steps 4-7 until the game ends.
5.0Actual Resources Used:

Sr
Name of Resource/Material Specification Qty. Remarks
No
1 Hardware Resource Intel i3,2GB RAM 1 -
2 Software Resource Turbo C/C++ 1 -
3 Any Other Resource Internet 1 -

6.0 CODE:
// C program to build the complete
// snake game

#include <conio.h>
#include <stdio.h>
#include <stdlib.h>

int i, j, height = 20, width = 20;


int gameover, score;
int x, y, fruitx, fruity, flag;

// Function to generate the fruit


// within the boundary
void setup()
{
gameover = 0;

// Stores height and width


x = height / 2;
y = width / 2;
label1:
fruitx = rand() % 20;
if (fruitx == 0)
goto label1;

label2:
fruity = rand() % 20;
if (fruity == 0)
goto label2;
score = 0;
}

// Function to draw the boundaries


void draw()
{
system("cls");
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 {
if (i == x && j == y)
printf("0");
else if (i == fruitx
&& j == fruity)
printf("*");
else
printf(" ");
}
}
printf("\n");
}

// Print the score after the


// game ends
printf("score = %d", score);
printf("\n");
printf("press X to quit the game");
}

// Function to take the input


void input()
{
if (kbhit()) {
switch (getch()) {
case 'a':
flag = 1;
break;

case 's':
flag = 2;
break;
case 'd':
flag = 3;
break;
case 'w':
flag = 4;
break;
case 'x':
gameover = 1;
break;
}
}
}

// Function for the logic behind


// each movement
void logic()
{
sleep(0.01);
switch (flag) {
case 1:
y--;
break;
case 2:
x++;
break;
case 3:
y++;
break;
case 4:
x--;
break;
default:
break;
}

// If the game is over


if (x < 0 || x > height
|| y < 0 || y > width)
gameover = 1;

// If snake reaches the fruit


// then update the score
if (x == fruitx && y == fruity) {
label3:
fruitx = rand() % 20;
if (fruitx == 0)
goto label3;

// After eating the above fruit


// generate new fruit
label4:
fruity = rand() % 20;
if (fruity == 0)
goto label4;
score += 10;
}
}

// Driver Code
void main()
{
int m, n;

// Generate boundary
setup();

// Until the game is over


while (!gameover) {

// Function Call
draw();
input();
logic();
}
}
getch();
}
OUTPUT:

7.0 Skill Developed:

a) Practical Outcomes:
1. We can perform basic operation of graphic
2. 2. We can apply different polygon filling
algorithms.
3. We learn about new header files.

b) Unit Outcomes in Cognitive Domain:

1. Manipulate visual and geometric information of images


2. Implement standard algorithms to draw various graphics objects using C program
Outcomes in Affective Domain:

1. We Followed safe practices.


2. We Practiced energy conversation.

Application of this Micro-Project:


1) To improve the graphics skills.
2)To improve accuracy.
3) To learn programming.

Name & Signature of Course


Teacher
(Prof.R.C.Mahajan)

You might also like