Professional Documents
Culture Documents
Snake and Ladder Game: Mini Project Report On
Snake and Ladder Game: Mini Project Report On
By
Ankit Joshi[19]
Supervisor
Prof. S. M. Satre (B-I & B-II)
1
Bharati Vidyapeeth College of Engineering, Navi Mumbai
Department of Information Technology
Academic Year 2019-2020
CERTIFICATE
Class- SEIT Semester-III have completed the Mini Project “Snake and Ladder
Game” Satisfactorily in the Department of Information Technology of as
prescribed by the Mumbai University in the academic year 2019-2020.
2
ABSTRACT
A snakes and ladders game is a simple board game which can be played between two to four
players. The four players race their token from start to finish by throwing their dice rolls. The
board is played on numbered grid squares which are filled with ladders and snakes on selected
boxes. The game is a game of chance and depends on the person’s luck. In these Project we have
implemented these game using java which is Platform independent. The objective of the project
is to make the much more interesting by introducing the GUI(Graphical user Interface) . The
game is beautifully designed which makes it attractive to the children and also for adults to
refresh their minds.The game has JDBC Connection which helps in storing the players data
securely and retrieve that data to show the high score which makes game Competitive.
3
Contents
1. Introduction
1.1 Background 05
1.2 Features 05
1.3 Objective 06
2. Review of Literature 07
3. System Study
3.1 Existing System 09
3.2 Proposed System 10
3.3 System Requirements 10
5. JDBC Connection 18
Chapter 1
4
Introduction
1.1Background
History
Snakes and Ladders originated in India as part of a family of dice board games that included
Gyan chauper and pachisi (present-day Ludo and Parcheesi). According to some historians , the
game was invented by saint gyandev in 13th centaury AD . Originally the game was used as part
of moral instruction to children. The squares in which ladder were supposed to be stand for
virtue and those housing for head of snakes were supposed to be evil. The game was transported
England by colonial rulers in 19th century with some modification. The modified game was
named Snake and Ladder and stripped of its moral and Religious aspects.
Today
Today Snake and Ladder is most widely played game among the small children. It is played on
square grid board having 100 tiles. The Objective of the game is to be the first player to reach
highest numbered spot on top row (100th tile).It is sheer Luck based Game where your position is
decided by a random dice
Snakes sets you back while Ladder helps in advance quickly.
It is comparatively an easy game and can be played without network connectivity.
1.2 Features
This Project is the replica of Snake and Ladder game with some changes and the features of the
project are:
1) GUI Interface
2) Multiplayer Game(2-4)
3) Database Connectivity
4) Platform Independent
5
1.3 Objectives
We made this game so that we could give our best in possible ways and show what we learned.
The Objective of this Project are
5) To make it Competitive
Chapter 2
6
Literature Review
Snake and ladder is a game that has been around for a longest of time, unknown of the inventor ,
it is believed the game was played at a time as early as 2nd century BC. Since then, the game
gained popularity for its playing system with vipers that demotes the player ‘s piece contrasting
with the ladder that promotes to higher number plates. It is predated yet an interesting game for
user to learn and be entertained. And as for programmers , it is a great way to begin the venture
in coding, sequential processing of data and abstraction on different function together to form a
unit.
After the popularity of computers sprang in the world, Snake and ladder was transformed to a
computer game which has the same characteristics, only with automation controlling the dice.
The following Literature review attempt to demonstrate and support the grounds for game snake
and ladder.
This game is programmed in java language. Java is a general-purpose programming language
that is class-based, object-oriented, and designed to have as few implementation dependencies as
possible. Sun Microsystems released the first public implementation as Java 1.0 in 1996.[25] It
promised Write Once, Run Anywhere (WORA), providing no-cost run-times on popular
platforms. This feature allows the game snake and ladder to be platform independent.
Swing is a graphical user interface library for the Java SE platform. It is possible to specify a
different look and feel through the pluggable look and feel system of Swing. Clones of
Windows, GTK+, and Motif are supplied by Sun. Apple also provides an Aqua look and feel for
macOS. Where prior implementations of these looks and feels may have been considered
lacking, Swing in Java SE 6 addresses this problem by using more native GUI widget drawing
routines of the underlying platforms. The game frame, images , buttons , Gif , message dialogues
were added in these game using jswing Library.
Java Database Connectivity (JDBC) is an application programming interface (API) for the
programming language Java, which defines how a client may access a database. Sun
Microsystems released JDBC as part of Java Development Kit (JDK) 1.1 on February 19, 1997.
[1] Since then it has been part of the Java Platform, Standard Edition (Java SE). The JDBC
classes are contained in the Java package java.sql and javax.sql. This allowed the game to store
the records of the player in secured database and retrieve that to show the high score of the
players.
Chapter 3
7
System Study
Snake and ladder is an ancient indian board game which is played today manually. This game is
played on a board having numbered gridded squares, snakes and ladder. In order to play these
game it is necessary to have a board , dice and player pieces. This board is made up of cardboard
or a plastic which can be easily broken down. Thus the manually played snake and ladder
possess lot of limitation. We are trying to develop a system which makes , look and feel very
interesting to play the game.
The Proposed system is designed to give a professional look and feeling GUI for snake and
ladder game. These game has a frame which is designed beautifully. The frame has different
components like
1) Message dialogues
2) Game board image, title Image , Snake GIFs, Players pieces , dice.
3) Buttons – Roll Button, Restart Button , High score Button
4) Background Color
5) Exit Option
Gameplay
Game play is very simple in snakes and ladder. The Player takes turn rolling the single die and
moving up spaces according to dice. If the player lands on the head of a snake , the game piece
will be sent back to the location of the snake s tail. If the game piece lands at the foot of a ladder
, The piece will climb up to the top , thus significantly advances to 100th winning Position.
Game Rules
8
5) The Player should be perfectly land on 100th position if it is going beyond that position then
player’s position remains unchanged. Example if player is on 97th position its position will only
change if dice rolls to 1,2,3 but not 4,5,6.
6) Only the winning player’s data will be saved in the database.
7) The High score can be viewed at any point of game.
8) Players can restart the game at any point.
Hardware Requirements
1) Window xp or above
2) Disk space 124 MB for
Software requirement
Chapter 4
9
Design Specification and Implication
The game initially starts with the welcome message(fig1). Then it takes number of players(fig2)
input from the players fallowed by their names(fig3).
Fig(1)
Fig(2) Fig(3)
10
4.2 Output Design
According to the given input by the user java frame will be designed and will be
displayed( Fig4). The frame will display the game title, Snake and ladder Board, Roll Button,
High Score Button , Restart Button and the Developers name, Players name and their pieces.
Fig(4)
Buttons
11
1) Roll Button
The Game begins by pressing the roll button. Each Player is assigned a circle with different
colors as their symbols. This symbol is present at side of roll button to indicate which player
chance it is. After Pressing the Roll Button dice image pops up with the number. According to it
player position is modified and is displayed on the board (Fig5). If there is no snake and ladder
over there player’s position remains same (Fig6 and Fig7). However if there is any snake or
ladder respective message pops up and the player position changes. The Snake gif is displayed
on frame when it is eaten by a snake(Fig6).
Fig(5)
12
Fig(6)
Fig(7)
13
2) Restart Button
Players can restart the game at any point(Fig8) or after the game is completed by pressing Restart
Button(Fig9).
Fig(8)
Fig(9)
14
3) High Score Button
It retrieves the data from the database(Fig10) by selecting the record having minimum rolls and
then displays it(Fig11).
Fig10
Fig11
15
4.3 System Architecture
The game frame has on one Jpanel which contains jlabels which helps in displaying various
components at different locations. JLabel is a class of java Swing. JLabel is used to display a
short string or an image icon. JLabel can display text, image or both. For Showing movement of
player pieces from one position to other we have created 100 Jlabels(Fig11) according to it we
have modified the size of snake and ladder board(Fig12).
100 99 98 97 96 95 94 93 92 91
81 82 83 84 85 86 87 88 89 90
80 79 78 77 76 75 74 73 72 71
61 62 63 64 65 66 67 68 69 70
60 59 58 57 56 55 54 53 52 51
41 42 43 44 45 46 47 48 49 50
40 39 38 37 36 35 34 33 32 31
21 22 23 24 25 26 27 28 29 30
20 19 18 17 16 15 14 13 12 11
1 2 3 4 5 6 7 8 9 10
Fig10 Fig11
Both the Fig will have same height and width, In our project it is 60 x 60. These 100 jlabels are
labeled are numbered same as board. Then we use another jlabel on this box of hundred jlabels
16
which displays the board image. Thus we aligned every squares of the board with the all the
Jlabels.
Thus to show players position we have remove its previous position by removing the image on
that particular jlabel and display its new position on respective jlabel which indirectly displays it
on the image board.
JFrame
Restart Button
Disposes the
Frame
Decides which player
piece to move
Retrieval of data
from the database
Checks multiple
conditions Snake or Ladder
17
Players position valid
Player winning
or not
JDBC Connection
Java Database Connectivity (JDBC) is an application programming interface (API) for the
programming language Java, which defines how a client may access a database. It is a Java-
based data access technology used for Java database connectivity. It is part of the Java Standard
Edition platform, from Oracle Corporation. It provides methods to query and update data in a
database, and is oriented towards relational databases
XAMPP is a software distribution which provides the Apache web server, MySQL database
(actually MariaDB), Php and Perl (as command-line executables and Apache modules) all in one
package. It is available for Windows, MAC and Linux systems. No configuration is necessary to
integrate Php with MySQL. The database of the game was made using phpMydmin.
This database saves the Players data after player wins the match. Here in the fig11 shows the
table present in our game database which stores the player name and number of rolls required to
win the match. This data is further used to retrieve the player having minimum rolls and display
it has high scorer.
18
Fig10
Chapter 6
6.1 Limitations
1) Graphical animation can be introduced in the game for example to show rolling of dice or
movement of player pieces from one place to another.
2) The Number of Players playing the game can be increased.
3) The game can be implemented using multithreading to increase the speed of game
19
4) The service of JDBC connection can be extended to save the unfinished game data and
load it play afterward.
5) Music system can be introduced in the game which will make more attractive
Conclusion
The primary objective of the project was to see how java, an object based oriented language can
be used to make an simple board game. Snake and Ladder is ancient game which is played today
by many small children. While making these project we were able to learn the concept of GUI in
java which made game attractive and interesting. Database connectivity in project helped in
giving additional features to game and make it more competitive. This game is platform
independent which means it can run on any machine.
20
References
1) XAMPP - https://www.cs.wcupa.edu/rkline/index/xampp.html
2) Wikipedia
21