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

Javamicro

The document is a micro project report on the implementation of a Snake Game using Java, prepared by students of the Sanjay Bhokare Group of Institutes. It outlines the project's objectives, methodology, and expected outcomes, emphasizing the educational value of learning Java programming through game development. The report includes details on programming concepts, game design, and resources required for the project.
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)
16 views19 pages

Javamicro

The document is a micro project report on the implementation of a Snake Game using Java, prepared by students of the Sanjay Bhokare Group of Institutes. It outlines the project's objectives, methodology, and expected outcomes, emphasizing the educational value of learning Java programming through game development. The report includes details on programming concepts, game design, and resources required for the project.
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/ 19

Shree Ambabai Talim Sanstha’s

SANJAY BHOKARE GROUP OF INSTITUTES, MIRAJ


FACULTY OF POLYTECHNIC
Institute Code: 1552

Department Of Computer Engineering


Micro Project Report
On

Implementation of Snake Game


Prepared By

Roll no. Enrolment No. Name

2243 23213180235 PATIL RAJ LALASO

2244 23213180236 PAWAR ROHAN RAJENDRA

2245 23213180237 PITAMBARE VARUN RAJESH

2246 23213180238 POTDAR KEDAR MANOJ

2247 23213180239 POTDAR SHREYASH SHRIKRUSHAN

2248 23213180240 SAKSHAM SIDDHARTH SHRIVASTAV

2249 23213180241 SARGAR VIKRAM RAMHARI

Under the Guidance of


Ms. N. R. Bhokare
Submitted To

Maharashtra State Board of Technical Education, Mumbai


(Autonomous) (ISO-9001-2008) (ISO/IEC 27001:2013)
Academic Year 2023-2024

1
MAHARASHTRA STATE
BOARD OF TECHNICAL EDUCATION
Certificate
(Only for individual micro project report)

This is to certify that Mr. / Ms. ………………………………………………………


Roll No. ……………….…., of 4th Semester of Diploma in Computer Engineering ,
of Institute ATS Sanjay Bhokare Group Of Institutes, Faculty Of Polytechnic,
Miraj. (Code: 1552) has completed the Micro-Project work satisfactorily in course
Java Programming (……..) for the academic year 2023 to 2024 as prescribed in
the curriculum.

Place: Miraj Enrollment No:.……………

Date: …………… Exam. Seat No: ……………

Subject Teacher Head of the Department Principal

2
MAHARASHTRA STATE
BOARD OF TECHNICAL EDUCATION
Certificate
This is to certify that following students,

Roll no. Enrolment No. Seat no Name

2243 23213180235 270262 PATIL RAJ LALASO

2244 23213180236 270263 PAWAR ROHAN RAJENDRA

2245 23213180237 270264 PITAMBARE VARUN RAJESH

2246 23213180238 270265 POTDAR KEDAR MANOJ

2247 23213180239 270266 POTDAR SHREYASH SHRIKRUSHAN

2248 23213180240 270267 SAKSHAM SIDDHARTH SHRIVASTAV

2249 23213180241 270268 SARGAR VIKRAM RAMHARI

of 4th Semester of Diploma in Computer Engineering , of Institute ATS Sanjay


Bhokare Group Of Institutes, Faculty Of Polytechnic, Miraj. (Code: 1552) has
completed the Micro-Project work satisfactorily in course Java Programming
(……..) for the academic year 2023 to 2024 as prescribed in the curriculum.

Place: Miraj
Date: ……………

Subject Teacher Head of the Department Principal

3
Annexure – I

PART A – Micro-Project Proposal

Implementation of Snake Game


1.0 Brief Introduction
Java is a widely used object-oriented programming language and software platform that
runs on billions of devices, including notebook computers, mobile devices, gaming
consoles, medical devices and many others. The rules and syntax of Java are based on the
C and C++ languages.
The Java-based Snake Game showcases fundamental programming concepts,
including object-oriented design, event handling, and graphical user interface
development. With intuitive keyboard controls, players navigate the snake through the
grid, facing the challenge of strategic movement to maximize their score. The game's
visual elements, from the snake's dynamic motion to the placement of fruits, are presented
using ASCII characters, providing a nostalgic and retro aesthetic. As a versatile and
educational project, the Snake Game serves as an excellent introduction to Java
programming for beginners, allowing them to gain hands-on experience in building a
graphical application. The code can be further extended and customized, making it a
valuable resource for learning advanced programming concepts, game development, and
software design. Overall, the Snake Game in Java offers a fun and interactive way for
developers to enhance their skills while enjoying the timeless appeal of this classic
gaming experience.

2.0 Aim of the Micro-Project


This Micro-Project aims at:
1. Java Programming Skills
2. Game Development Basics
3. Problem Solving
4. Project Management

3.0 Intended Course Outcomes


a. Develop programs using Object Oriented methodology in Java.
b. Apply concept of inheritance for code reusability.
c. Develop programs using multithreading.
d. Implement Exception Handling.
e. Develop programs using graphics

4
4.0 Literature Review
Video game development is the process of creating a video game. The effort is undertaken by a
game developer, who may range from a single person to an international team dispersed across
the globe. A video game can be developed in many different languages, one of them being Java,
Java is one of the best languages in which one can develop lop a game . Coding in Java allows
one to make games that will run on all the desktop stop operating systems like Windows, OSX
and Linux but also it is the native language for making games for all And Android devices. A
game can. be developed in Java by using IDE's. Eclipse is an Integrated Development
Environment for Java. We can use Eclipse for coding and executing the games. The Snake Game
is one of the games that can be implemented in Java. Here the snake is moved around by the
player, for it to reach the apple. It takes us one step forward to learning more about the computer
languages.

4.0 Proposed Methodology


1. Naming Conventions:
• Java naming conventions recommend using camelCase for variable names. Consider
using camelCase for variable names like gameOver, fruitX, fruitY, score, tailLength, and
dir.
• The constant variables like WIDTH, HEIGHT, TILE_SIZE, and GAME_SPEED are
appropriately named using uppercase letters with underscores.
2. Structure and Organization:
• The structure of your code looks good, and you have used methods to break down
functionality into logical unit
• Consider adding comments to explain complex sections of your code or any
algorithms you are using.
3. Magic Numbers:
• Consider replacing magic numbers with named constants or variables to make the
code more readable and maintainable. For example, the number 100 is used in the array
size declaration for tailX and tailY. Instead, you could use a constant like
MAX_TAIL_SIZE.
4. Graphics Drawing:
• The drawing of the game elements in the draw method is clear and concise. However,
you might consider using a more flexible approach, such as creating a grid-based system
for drawing the game elements.
5. Key Handling:
• Handling key events seems well-implemented. You're using KeyEvent.VK_LEFT,
KeyEvent.VK_RIGHT, etc., to determine the direction of the snake.
6. Random Fruit Placement:

5
• The random placement of the fruit is done using Math.random(). While this works, it
might be more visually appealing to ensure that the fruit is not placed on the snake's
body.

7. Game Over Handling:


• The game over handling and display in the gameOver method are clear. It might be
helpful to add instructions for restarting the game or exiting the application.
8. Timer Usage:
• You're using a Timer to control the game speed. The GAME_SPEED constant
determines the delay between timer events. Consider adding comments to explain how
this value affects the game speed.
9. Unused Imports:
• There are some unused import statements at the beginning of your code. You may
want to remove them for cleaner code.
10. Closing Parenthesis in gameOver Method:
• The gameOver method seems to be missing a closing parenthesis.

5.0 Resources Required


S. No. Name of Resource/material Specifications Qty Remarks
1 Hardware: Computer Computer
system i5,version
Ram 8GB
2 Operating system Windows 10
3 Software Eclipses

6.0 Action Plan


S. No. Details of activity Planned Planned Name of Responsible
Start date Finish date Team Members
1 Make a correct code of program
2 Making format report
3 Doing corrections

**************

6
Annexure – II
PART B – Micro-Project Report

Implementation of Snake Game


1.0 Rationale
Java is a widely used object-oriented programming language and software platform that
runs on billions of devices, including notebook computers, mobile devices, gaming
consoles, medical devices and many others. The rules and syntax of Java are based on the
C and C++ languages.
The Java-based Snake Game showcases fundamental programming concepts,
including object-oriented design, event handling, and graphical user interface
development. With intuitive keyboard controls, players navigate the snake through the
grid, facing the challenge of strategic movement to maximize their score. The game's
visual elements, from the snake's dynamic motion to the placement of fruits, are presented
using ASCII characters, providing a nostalgic and retro aesthetic. As a versatile and
educational project, the Snake Game serves as an excellent introduction to Java
programming for beginners, allowing them to gain hands-on experience in building a
graphical application. The code can be further extended and customized, making it a
valuable resource for learning advanced programming concepts, game development, and
software design. Overall, the Snake Game in Java offers a fun and interactive way for
developers to enhance their skills while enjoying the timeless appeal of this classic
gaming experience.

2.0 Course Outcomes Addressed


a. Develop programs using Object Oriented methodology in Java.
b. Apply concept of inheritance for code reusability.
c. Implement Exception Handling and Develop programs using graphics

7
3.0 Literature Review
Video game development is the process of creating a video game. The effort is undertaken
by a game developer, who may range from a single person to an international team dispersed
across the globe. A video game can be developed in many different languages, one of them being
Java, Java is one of the best languages in which one can develop lop a game . Coding in Java
allows one to make games that will run on all the desktop stop operating systems like Windows,
OSX and Linux but also it is the native language for making games for all And Android devices.
A game can. be developed in Java by using IDE's. Eclipse is an Integrated Development
Environment for Java. We can use Eclipse for coding and executing the games. The Snake Game
is one of the games that can be implemented in Java. Here the snake is moved around by the
player, for it to reach the apple. It takes us one step forward to learning more about the computer
languages.
A comprehensive literature review of Snake Game development using the java programming
language reveals that while there might be limited formal academic research on this specific
topic, there is a wealth of educational materials, tutorials, and community resources available.
Many tutorials and online forums provide practical guidance for implementing a Snake Game in
Java, elucidating key concepts such as game loop architecture, object-oriented design, collision
detection algorithms, and user interface development. Java’s versatility as a language for game
development is often demonstrated through such projects, showcasing its applicability in both
educational and recreational contexts. Furthermore, the open-source community contributes to
the collective knowledge, offering valuable insights into best practices, code samples, and
common challenges encountered in java-based game development. While scholarly research
might be scant, the abundance of practical resources and shared expertise in online communities
makes Snake Game development a widely accessible and educational domain for aspiring game
developers and java programmers.

4.0 Actual Methodology Followed


package snakeproject;

import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.Timer;

8
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;

public class SnakeGame extends JFrame implements ActionListener, KeyListener {

private static final long serialVersionUID = 1L;


private static final int WIDTH = 25;
private static final int HEIGHT = 25;
private static final int TILE_SIZE = 20;
private static final int GAME_SPEED = 150;

private boolean gameOver;


private int x, y, fruitX, fruitY, score;
private int[] tailX, tailY;
private int tailLength;
private Direction dir;

private enum Direction {


STOP, LEFT, RIGHT, UP, DOWN
}

public SnakeGame() {
setTitle("Snake Game");
setSize(WIDTH * TILE_SIZE, HEIGHT * TILE_SIZE);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLocationRelativeTo(null);
setResizable(false);
addKeyListener(this);

x = WIDTH / 2;

9
y = HEIGHT / 2;
dir = Direction.STOP;

tailX = new int[100];


tailY = new int[100];

fruitX = (int) (Math.random() * WIDTH);


fruitY = (int) (Math.random() * HEIGHT);

score = 0;
tailLength = 0;

gameOver = false;

Timer timer = new Timer(GAME_SPEED, this);


timer.start();
}

public static void main(String[] args) {


SwingUtilities.invokeLater(() -> {
SnakeGame game = new SnakeGame();
game.setVisible(true);
});
}

@Override
public void actionPerformed(ActionEvent e) {
if (!gameOver) {
logic();
repaint();
}
}

private void logic() {


int prevX = tailX[0];
int prevY = tailY[0];
int prev2X, prev2Y;

tailX[0] = x;

10
tailY[0] = y;

for (int i = 1; i < tailLength; i++) {


prev2X = tailX[i];
prev2Y = tailY[i];
tailX[i] = prevX;
tailY[i] = prevY;
prevX = prev2X;
prevY = prev2Y;
}

switch (dir) {
case LEFT:
x--;
break;
case RIGHT:
x++;
break;
case UP:
y--;
break;
case DOWN:
y++;
break;
}

if (x >= WIDTH)
x = 0;
else if (x < 0)
x = WIDTH - 1;

if (y >= HEIGHT)
y = 0;
else if (y < 0)
y = HEIGHT - 1;

for (int i = 0; i < tailLength; i++) {


if (tailX[i] == x && tailY[i] == y) {
gameOver = true;

11
break;
}
}

if (x == fruitX && y == fruitY) {


score += 10;
fruitX = (int) (Math.random() * WIDTH);
fruitY = (int) (Math.random() * HEIGHT);
tailLength++;
}
}

@Override
public void paint(Graphics g) {
super.paint(g);

if (!gameOver) {
draw(g);
} else {
gameOver(g);
}
}

private void draw(Graphics g) {


for (int i = 0; i < WIDTH + 1; i++)
g.drawString("#", i * TILE_SIZE, TILE_SIZE);
for (int i = 0; i < HEIGHT; i++) {
for (int j = 0; j < WIDTH; j++) {
if (j == 0)
g.drawString("#", 0, (i + 1) * TILE_SIZE);
if (i == y && j == x)
g.drawString("O", (j + 1) * TILE_SIZE, (i + 1) * TILE_SIZE);
else if (i == fruitY && j == fruitX)
g.drawString("F", (j + 1) * TILE_SIZE, (i + 1) * TILE_SIZE);
else {
int printTail = 0;
for (int k = 0; k < tailLength; k++) {
if (tailX[k] == j && tailY[k] == i) {
g.drawString("o", (j + 1) * TILE_SIZE, (i + 1) * TILE_SIZE);

12
printTail = 1;
}
}
if (printTail == 0)
g.drawString(" ", (j + 1) * TILE_SIZE, (i + 1) * TILE_SIZE);
}
if (j == WIDTH - 1)
g.drawString("#", (j + 2) * TILE_SIZE, (i + 1) * TILE_SIZE);
}
}
for (int i = 0; i < WIDTH + 2; i++)
g.drawString("#", i * TILE_SIZE, (HEIGHT + 1) * TILE_SIZE);
g.drawString("Score: " + score, 10, 10);
}

private void gameOver(Graphics g) {


g.setColor(Color.BLACK);
g.setFont(new Font("Arial", Font.BOLD, 30));
g.drawString("Game Over!", WIDTH * TILE_SIZE / 4, HEIGHT * TILE_SIZE /
2);
g.drawString("Score: " + score, WIDTH * TILE_SIZE / 3, HEIGHT *
TILE_SIZE / 2 + 50);

@Override
public void keyTyped(KeyEvent e) {
}

@Override
public void keyPressed(KeyEvent e) {
int key = e.getKeyCode();
switch (key) {
case KeyEvent.VK_LEFT:
if (dir != Direction.RIGHT)
dir = Direction.LEFT;
break;
case KeyEvent.VK_RIGHT:

13
if (dir != Direction.LEFT)
dir = Direction.RIGHT;
break;
case KeyEvent.VK_UP:
if (dir != Direction.DOWN)
dir = Direction.UP;
break;
case KeyEvent.VK_DOWN:
if (dir != Direction.UP)
dir = Direction.DOWN;
break;
case KeyEvent.VK_X:
gameOver = true;
break;
}
}

@Override
public void keyReleased(KeyEvent e) {
}
}

5.0 Actual Resources Used

S. No. Name of Resource/material Specifications Qty Remarks


1 Make a correct code of
program
2 Making format report
3 Doing corrections

14
6.0 Outputs of the Micro-Project

7.0 Skill Developed / learning out of this Micro-Project


The development of a Snake Game microproject in Java offers a platform for students to
acquire and hone a diverse set of skills. Firstly, it reinforces core programming competencies,
enhancing students proficiency in Java through the practical application of data structures,
algorithms, and object-oriented design. They become adept at solving complex problems,
such as collision detection, game logic, and user input handling, promoting analytical and
critical thinking skills. Additionally, this project nurtures skills related to software
development practices, emphasizing code organization, documentation, and debugging, all of
which are crucial in real-world software engineering. Teamwork and collaboration skills are
nurtured through group-based project work, fostering effective communication and joint
problem-solving. Creativity comes into play when designing the game’s user interface and
visual elements, allowing students to explore their artistic and aesthetic abilities. Overall,
developing a Snake Game microproject empowers students with a holistic skill set,
encompassing programming proficiency, problem-solving acumen, software development
best practices, teamwork, and creativity, making it a valuable learning experience.

8.0 Applications of this Micro-Project


A snake Game microproject created using Java has several practical applications and
benefits. First and foremost, it serves as an excellent educational tool for teaching programming
concepts and object-oriented design. Students, especially beginners, can grasp fundamental

15
programming principles while working on this project, such as variables, loops, conditional
statements, and data structures. It offers an engaging and interactive way to learn these concepts,
making it a valuable resource in coding.

9.0 Area of Future Improvement


1. Levels and Difficulty:
2. High Scores:
3.Sound Effects and Music.
4. User Interface Improvements:
5. Mobile Compatibility:
**************

16
Annexure – III

Teacher Evaluation Sheet

Name of Student: ………………………………………………………… Enrollment No. ……………………………………


Name of Programme Computer Engineering Semester: 4th Course Title Java Programming
Code:……………

Title of the Micro-Project: Implementation of Snake Game

(For Office Use Only)


Course Outcomes Achieved
………………………………………………………………………………………………………………………………………………..
…………………………………………………………………………………………………………………………………………………
………………………………………………………………………………………………………………………………………………….
Evaluation as per Suggested Rubric for Assessment of Micro Project
 (Please tick in appropriate cell for each characteristic)
S. Characteristic to Poor Average Good Excellent
No be assessed ( Marks 1-3 ) ( Marks 4 - 5 ) ( Marks 6 - 8 ) ( Marks 9- 10 )
.
1 Relevance to the Relate to very Related to some Take care of at- Take care of more
course few LOs Los least one CO than one CO
 ..
2 Literature Not more than At-least 5 relevant At –least 7 About 10 relevant
Survey two sources sources, at least 2 relevant sources, sources, most
/information (primary and latest most latest latest
collection secondary), very
old reference

3 Completion of Completed less Completed 50 to Completed 60 to Completed more


the Target as per than 50% 60% 80% than 80 %
project proposal
4 Analysis of Data Sample Size Sufficient and Sufficient and Enough data
and small, data appropriate appropriate collected by
representation neither sample, enough sample, enough sufficient and
organized nor data generated data generated appropriate
presented well but not organized which is organized sample size.
and not presented and presented Proper inferences
well. No or poor well but poor drawn by
inferences drawn inferences drawn organising and
presenting data
through tables,
charts and graphs.

5 Quality of Incomplete Just Well Well


Prototype/Mode fabrication/asse assembled/fabrica assembled/fabrica assembled/fabrica
l mbly. ted and parts are ted with proper ted with proper

17
S. Characteristic to Poor Average Good Excellent
No be assessed ( Marks 1-3 ) ( Marks 4 - 5 ) ( Marks 6 - 8 ) ( Marks 9- 10 )
.
not functioning functioning parts. functioning parts.
well. Not in proper In proper shape, In proper shape,
shape, dimensions within tolerance within tolerance
beyond tolerance dimensions and dimensions and
limit. good good
Appearance/finish finish/appearance. finish/appearance.
is shabby. But no creativity in Creativity in
design and use of design and use of
material material

6 Report Very short, poor Nearly sufficient Detailed, correct Very detailed,
Preparation quality sketches, and correct details and clear correct, clear
Details about about methods, description of description of
methods, material, methods, methods,
material, precautions and materials, materials,
precaution and conclusion, but precautions and precautions and
conclusions clarity is not there Conclusions. conclusions.
omitted, some in presentation. Sufficient Graphic Enough tables,
details are But not enough Description. charts and
wrong graphic sketches
description.

7 Presentation Major Includes major Includes major Well organized,


information is information but information and includes major
not included, not well organized well organized but information ,well
information is and not presented not presented well presented
not well well
organized .
8 Any other
(depending upon
nature of
project: please
write indicators
by pen)
Defense Could not reply Replied to Replied properly Replied most of
9 to considerable considerable to considerable the questions
number of number of number of properly
question. questions but not question.
very properly

18
MIcro-Project Evaluation Sheet

Process Assessment Product Assessment Total


Part A - Project Project Methodology Part B - Project individual Marks
Proposal (2 marks) Report/Working Model Presentation/Viva 10
(2 marks) (2 marks) (4 marks)

Note:
Every course teacher is expected to assign marks for group evolution for each group of students in first 3
columns as per rubrics & individual evaluation in 4TH column for each group of students as per rubrics based
on viva.

Comments/Suggestions about team work/leadership/inter-personal communication (if any)


………………………………………………………………………………………………
……………………………………………………………………………………………..
……………………………………………………………………………………………..
……………………………………………………………………………………………..

Any Other Comment:


……………………………………………………………………………………………
……………………………………………………………………………………………
……………………………………………………………………………………………
………………………………………………………………………………………………

Name and designation of the Faculty Member…………………………………….

Signature………………………………………………………………………………

Date:………………………..

19

You might also like