Mini Project Documentation Format
Mini Project Documentation Format
Mini project report submitted at the end of fourth semester in partial fulfillment of the
requirement for the award of the degree of
BACHELOR OF TECHNOLOGY
IN
COMPUTER SCIENCE AND ENGINEERING
By
GARAPATI BHAVANA G. DEVI PRIYANKA B .ESHITA KARUNA
(Regd No: 17981A0553) (Regd No: 17981A0551) (Regd No: 17981A0518)
B.SAI KRISHNA Ch.JASWANTH GUDIVADA PRAMOD
(Regd No: 17981A0511) (Regd No: 17981A0531) (Regd No: 17981A0547)
Under the esteemed guidance
of
Mr.Dr.ABHINASH TRIPATHY
Assistant Professor
1
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
RAGHU ENGINEERING COLLEGE
(Autonomous)
Accredited by NAAC and NBA, Affiliated to JNTU-Kakinada
Dakamarri (V), Bheemunipatnam (M),
Visakhapatnam
CERTIFICATE
This is to certify that this project entitled “Snakes & Ladders” done by G.Bhavana,
17981A0547 during the academic year 2018-2019 in partial fulfillment of the requirements
for the completion of fourth semester of Bachelor of Technology in Computer Science And
EXTERNAL EXAMINER
2
DECLARATION
This is to certify that this project titled “Snakes & Ladders” is bonafide work done
by us, in partial fulfillment of the requirements for the completion of fourth semester of the
degree B.Tech and submitted to the Department of Computer Science & Engineering,
We also declare that this project is a result of our own effort and that has not been
copied from anyone and we have taken only citations from the sources which are
Ch.Jaswanth G.Pramod
3
4
INDEX
PROJECT TITLE i
CERTIFICATE ii
DECLARATION iii
ABSTRACT iv
1. INTRODUCTION 2
1.1. FUNCTIONS 3
2. SYSTEM SPECIFICATIONS
3.3. OBECTIVES 7
3.4. MODULES 7
4. TECHNICAL REQUIREMENTS
6. SCREEN SHOTS 37
7. FURTHER ENHANCEMENT 43
8. CONCLUSION 45
10. REFERENCES 50
ABSTRACT
4
ABSTRACT
Snakes and Ladders is one of the ancient games in India. It is an indoor game played
on a board which is similar to a bunch of two dimensional arrays with some snakes and
ladders in between. The minimum number of players to play this game is two, the rule is
simple there are 1 to 100 blocks/tiles and whenever a die is rolled the number on the die is the
count the number of steps moved by the player and whenever any of the player attains 100 th
block ,the player is considered winner and in between the blocks they are snakes and ladders,
whenever you roll a dice and it lands on a ladder your position is elevated to the other head of
the ladder, if you land on a snake your position is decreased to the tail of the snake.
This program is implemented using Abstract Window Tool Kit through Java Programming,
and is for two players and is interactive with the users. The interface is created using
AWT,and the back end for storing the details of the player is implemented using File Data
Base.
5
6
INTRODUCTION
1
INTRODUCTION
Snakes and Ladders is an ancient Indian board game regarded today as a worldwide classic.
It is played between two or more players on a game board having numbered, gridded squares.
A number of "ladders" and "snakes" are pictured on the board, each connecting two specific
board squares. The object of the game is to navigate one's game piece, according to die rolls,
from the start (bottom square) to the finish (top square), helped or hindered by ladders and
snakes, respectively.
The game is a simple race contest based on sheer luck, and is popular with young children.
The historic version had root in morality lessons, where a player's progression up the board
represented a life journey complicated by virtues (ladders) and vices (snakes).
2
Rules:
*Each player puts their counter on the space that says 'start here'.
*Take it in turns to roll the dice. Move your counter forward the number of spaces shown on
the dice.
*If your counter lands at the bottom of a ladder, you can move up to the top of the ladder.
*If your counter lands on the head of a snake, you must slide down to the bottom of the
snake.
*The first player to get to the space that says 'home' is the winner.
Functions
Make sure each of the players get equal number of chances to roll a die
3
SYSTEM
SPECIFICATIONS
4
Hardware Requirements
Software Requirements
5
SOFTWARE
REQUIREMENT
ANALYSIS
6
SOFTWARE REQUIREMENT ANALYSIS
EXISTING SYSTEM
Most of the existing system of this game are manual and the other applications
which are there requires internet to play, and more system space as they are involved with
huge amounts of data and they are hard to implement.
DISADVANTAGES
The following drawbacks of existing system emphasize the need for computerization:
PROPOSED SYSTEM
This application is simple piece of code, where no permission of the user system is
required, and as it is implemented using Abstract Window Tool Kit of JAVA which acts as the
front end so it can be played without server and internet and the winners list is stored in
single file aiming to reduce significant amount of storage.
MODULES
There are mainly three modules in this system and they are also indicated using Phases.
Phase1:
7
This phase is where the set up page of the game window is popped, and the users
have to write their names in the respective spaces and roll a die to start the game.
Phase2 :
This phase is where the player-1 gets the chance to play followed by player-2 abiding the
instructions that whenever the user gets to encounter ladder /snake.
Phase3:
This phase ensures that equal number of chances are given for both the users and who
ever first reaches the end position is declared winner and the name of the player is stored in
the file data base.
8
TECHNICAL
REQUIREMENTS
9
TECHNICAL OVERVIEW
Introduction to JAVA
What is JAVA?
10
User Interface Toolkits: The JavaFX, Swing, and Java 2D toolkits make it
possible to create sophisticated Graphical User Interfaces (GUIs).
Integration Libraries: Integration libraries such as the Java IDL API, JDBC
API, Java Naming and Directory Interface (JNDI) API, Java RMI, and Java Remote
Method Invocation over Internet Inter-ORB Protocol Technology (Java RMI-IIOP
Technology) enable database access and manipulation of remote objects.
Why JAVA?
Object Oriented
In Java, everything is an Object. Java can be easily extended since it is based on the
Object model.
Platform Independent
Unlike many other programming languages including C and C++, when Java is
compiled, it is not compiled into platform specific machine, rather into platform-
independent byte code. This byte code is distributed over the web and interpreted by
the Virtual Machine (JVM) on whichever platform it is being run on.
Simple
Java is designed to be easy to learn. If you understand the basic concept of OOP Java,
it would be easy to master.
Secure
Architecture-neutral
Java compiler generates an architecture-neutral object file format, which makes the
compiled code executable on many processors, with the presence of Java runtime
system.
11
Portable
Robust
Multithreaded
With Java's multithreaded feature it is possible to write programs that can perform many tasks
simultaneously. This design feature allows the developers to construct interactive applications
that can run smoothly.
Interpreted
Java byte code is translated on the fly to native machine instructions and is not stored
anywhere. The development process is more rapid and analytical since the linking is an
incremental and light-weight process.
High Performance
Distributed
Dynamic
Introduction to AWT
AWT stands for Abstract Window Toolkit. It is a toolkit of classes with which a
programmer can develop Graphics and Graphical User Interface components. AWT gives a
front-end technology to Java using which a user can interact with a running process; the old
12
style is scanf. Usage of GUI environment is easier even for a non-computer background
person. A business man or an elementary school student is able to use email system and all
the credit goes to GUI, which Java supports very extensively.
All the classes required for developing graphics and GUI are placed in the package java.awt
and the classes required for event handling are placed separately in the sub
package java.awt.event. These two are very big packages and contains lot of classes doing
different functionalities. To study these classes, the whole tutorial can be divided into the
following topics.
Drawing graphics
Studying layout managers
Developing GUI components
Handling events – Event handling
13
SAMPLE CODE
14
SNL.java
import java.awt.*;
import java.io.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.Random;
import java.awt.color.*;
class SNL
JLabel tf,a3,x,l[],m[],dc[],z,k,r;
JTextField tf1,tf2;
JButton b1;
JButton au,reset,start;
JTextField screen;
SNL()
15
l=new JLabel[101];
m=new JLabel[6];
m[1]=new JLabel();
m[1].setBounds(140,650,20,52);
m[1].setIcon(new ImageIcon(".//player2.png"));
f.add(m[1]);
m[2]=new JLabel();
m[2].setBounds(70,650,20,52);
m[2].setIcon(new ImageIcon(".//player1.png"));
f.add(m[2]);
m[4]=new JLabel();
m[4].setBounds(5,290,20,52);
m[4].setIcon(new ImageIcon(".//player2.png"));
f.add(m[4]);
m[5]=new JLabel();
m[5].setBounds(5,340,20,52);
m[5].setIcon(new ImageIcon(".//player1.png"));
f.add(m[5]);
16
m[3]=new JLabel();
m[3].setBounds(50,570,150,150);
m[3].setIcon(new ImageIcon(".//start.jpg"));
f.add(m[3]);
int j=0;
for(int i=100;i>90;i--)
l[i]=new JLabel();
l[i].setBounds((200+j*70),0,70,70);
l[i].setIcon(new ImageIcon(".//cut/"+i+".jpg"));
f.add(l[i]);
j++;
j=0;
for(int i=80;i>70;i--)
17
l[i]=new JLabel();
l[i].setBounds((200+j*70),140,70,70);
l[i].setIcon(new ImageIcon(".//cut/"+i+".jpg"));
f.add(l[i]);
j++;
j=0;
for(int i=60;i>50;i--)
l[i]=new JLabel();
l[i].setBounds((200+j*70),280,70,70);
l[i].setIcon(new ImageIcon(".//cut/"+i+".jpg"));
f.add(l[i]);
j++;
j=0;
for(int i=40;i>30;i--)
18
{
l[i]=new JLabel();
l[i].setBounds((200+j*70),420,70,70);
l[i].setIcon(new ImageIcon(".//cut/"+i+".jpg"));
f.add(l[i]);
j++;
j=0;
for(int i=20;i>10;i--)
l[i]=new JLabel();
l[i].setBounds((200+j*70),560,70,70);
l[i].setIcon(new ImageIcon(".//cut/"+i+".jpg"));
f.add(l[i]);
j++;
j=0;
for(int i=81;i<91;i++)
19
{
l[i]=new JLabel();
l[i].setBounds((200+j*70),70,70,70);
l[i].setIcon(new ImageIcon(".//cut/"+i+".jpg"));
f.add(l[i]);
j++;
j=0;
for(int i=61;i<71;i++)
l[i]=new JLabel();
l[i].setBounds((200+j*70),210,70,70);
l[i].setIcon(new ImageIcon(".//cut/"+i+".jpg"));
f.add(l[i]);
j++;
j=0;
20
for(int i=41;i<51;i++)
l[i]=new JLabel();
l[i].setBounds((200+j*70),350,70,70);
l[i].setIcon(new ImageIcon(".//cut/"+i+".jpg"));
f.add(l[i]);
j++;
j=0;
for(int i=21;i<31;i++)
l[i]=new JLabel();
l[i].setBounds((200+j*70),490,70,70);
l[i].setIcon(new ImageIcon(".//cut/"+i+".jpg"));
f.add(l[i]);
j++;
j=0;
21
for(int i=1;i<11;i++)
l[i]=new JLabel();
l[i].setBounds((200+j*70),630,70,70);
l[i].setIcon(new ImageIcon(".//cut/"+i+".jpg"));
f.add(l[i]);
j++;
tf=new JLabel();
tf.setBounds(920,0,37,663);
tf.setIcon(new ImageIcon(".//aaaa.png"));
f.add(tf);
z=new JLabel();
z.setBounds(0,0,200,100);
z.setIcon(new ImageIcon(".//rms.jpg"));
f.add(z);
screen.setBounds(25,250,150,40);
screen.setBackground(Color.BLACK);
22
screen.setForeground(Color.GREEN);
f.add(screen);
tf1=new JTextField();
tf1.setBounds(25,310,150,35);
tf1.setText("Player 1");
f.add(tf1);
tf1.setBackground(Color.PINK);
tf2=new JTextField();
tf2.setBounds(25,350,150,35);
tf2.setText("Player 2");
f.add(tf2);
tf2.setBackground(Color.PINK);
k=new JLabel();
k.setBounds(60,400,100,100);
f.add(k);
a3=new JLabel();
a3.setBounds(50,400,100,100);
a3.setText("");
a3.setIcon(new ImageIcon(".//dice.gif"));
23
f.add(a3);
r.setBounds(20,120,140,40);
b1=new JButton();
b1.setBounds(25,490,150,40);
b1.setText("Roll");
b1.addActionListener(o);
f.add(b1);
myimage.setForeground(Color.WHITE);
myimage.setBounds(120,400,100,100);
f.add(myimage);
tf.setFont(font1);
tf1.setFont(font);
screen.setFont(font2);
24
tf2.setFont(font);
myimage.setFont(font3);
a3.setFont(font1);
b1.setFont(font3);
f.setLayout(null);
reset=new JButton("reset");
reset.addActionListener(o);
reset.setBounds(40,170,120,40);
reset.setIcon(new ImageIcon(".//reset.png"));
f.add(reset);
f.setLayout(null);
f.setLayout(null);
f.setVisible(true);
f.setResizable(true);
//f.add(bg);
f.setSize(990,735);
f.getContentPane().setBackground(new Color(255,130,4));
25
{
new SNL();
SNL d;
int rno,x1,y1;
static int w;
double y,z;
Listener(SNL d)
this.d=d;
//this.tf1=tf1.getText();
void randomNumber()
26
Random generator = new Random();
rno = generator.nextInt(6) + 1;
d.myimage.setText(String.valueOf(rno));
d.a3.setVisible(true);
if(e.getSource()==d.reset)
{ d.m[1].setBounds(140,650,20,52);
d.m[2].setBounds(70,650,20,52);
d.myimage.setText(" ");
pc1=0;
w=0;
pc2=0;
else if(e.getSource()==d.au)
27
jn.setBounds(20,20,900,562);
jn.setSize(900,600);
jn.setVisible(true);
a4.setBounds(0,0,900,562);
a4.setText("");
a4.setIcon(new ImageIcon(".//ma.jpg"));
jn.add(a4);
else if(e.getSource()==d.b1)
randomNumber();
if(w%2==0)
d.screen.setText("Player 2 chance");
w++;
if((pc1+rno)<101)
28
pc1=pc1+rno;
r=d.l[pc1].getBounds();
y=r.getX();
z=r.getY();
x1=(int)Math.round(y);
y1=(int)Math.round(z);
d.m[1].setBounds((x1+10),(y1+20),20,52);
for(int i=0;i<8;i++)
if(pc1==a[i])
{ r=d.l[b[i]].getBounds();
y=r.getX();
z=r.getY();
x1=(int)Math.round(y);
y1=(int)Math.round(z);
d.m[1].setBounds((x1+10),(y1+17),20,52);
pc1=b[i];
29
}
for(int i=0;i<7;i++)
if(pc1==c[i])
{ r=d.l[f[i]].getBounds();
y=r.getX();
z=r.getY();
x1=(int)Math.round(y);
y1=(int)Math.round(z);
d.m[1].setBounds((x1+10),(y1+16),20,52);
pc1=f[i];
else
30
{
d.screen.setText("Player 1 chance");
w++;
if((pc2+rno)<101)
{pc2=pc2+rno;
r=d.l[pc2].getBounds();
y=r.getX();
z=r.getY();
x1=(int)Math.round(y);
y1=(int)Math.round(z);
d.m[2].setBounds((x1+30),(y1+20),20,52);
for(int i=0;i<8;i++)
if(pc2==a[i])
31
{ r=d.l[b[i]].getBounds();
y=r.getX();
z=r.getY();
x1=(int)Math.round(y);
y1=(int)Math.round(z);
d.m[2].setBounds((x1+30),(y1+17),20,52);
pc2=b[i];
for(int i=0;i<7;i++)
if(pc2==c[i])
{ r=d.l[f[i]].getBounds();
y=r.getX();
z=r.getY();
x1=(int)Math.round(y);
32
y1=(int)Math.round(z);
d.m[2].setBounds((x1+130),(y1+160),20,52);
pc2=f[i];
if(pc1==100)
d.screen.setText("Player 1 wins");
try
outfile.write("Player 1 wins");
outfile.close();
33
catch(Exception aed)
else if(pc2==100)
d.screen.setText("Player 2 wins");
try
outfile.write("Player 2 wins");
outfile.close();
catch(Exception aed)
34
}
35
SCREEN SHOTS
36
Initially, the board displays and ask to roll the dice.
37
The game continues as player 1, followed by Player2
38
39
The game continues with couple of moves.
40
After clicking on reset button to play a new game,
41
FUTURE
ENHANCEMENTS
42
FUTURE ENHANCEMENT
That id multiple indoor games once played, would be inherited into this single platform and
can be played according to the user’s wish makes it easy as there are multiple games at a
single platform.
Rather than using files we can use other database such as MYSQL,MONGO DB for easy
manipulation of data.
43
CONCLUSION
44
CONCLUSION
With the best to our knowledge we have designed this Snakes & Ladders
game, which is now-a-days replaced with the modern ravishing new games in this globalized
world which consumes less space, required no system data, and is not simple to implement
With lots of future advancements the game can be still more made better like
recognizing the patterns, data giving scope for data analysis and also improved by
establishing new rules, multiple payers system or even multiple games in single platform
45
MY
CONTRIBUTION
46
GARAPATI BHAVANA’S CONTRIBUTION
Assembled the documentation for the project dealing with its technical aspects.
Researched the technical concepts of the various libraries used in this project to
document them.
I helped in making the Back End for the project.
Researched the technical concepts of the various libraries used in this project to
document them.
I helped in making the Front End for the project.
Helped the team leader for getting the hard copies.
47
As the group member of the project,B.Sai Krishna bearing Regd NO. 17981A0511
my contribution to the project is as follows
Researched the technical concepts of the various libraries used in this project to
document them.
Helped the team leader for getting editing the document.
Ch.JASWANTH’S CONTRIBUTION
G.PRAMOD’S CONTRIBUTION
Researched the technical concepts of the various libraries used in this project to
document them.
Helped the team leader for editing the document.
48
REFERENCES
49
REFERENCES
http://www.w3schools.com/
http://www.tutorialspoint.com/
https://docs.oracle.com/javase/tutorial/getStarted/intro/cando.html
https://en.wikipedia.org/wiki/Snakes_and_Ladders
https://geany.org/
http://www.tutorialspoint.com/java-awt/
50