Вы находитесь на странице: 1из 31

1.

INTRODUCTION
1.1 About the System
2048 is a single-player puzzle game. 2048 is played on a gray 44 grid, with numbered tiles
that slide smoothly when a player moves them using the four arrow keys. Every turn, a new
tile will randomly appear in an empty spot on the board with a value of either 2 or 4. Tiles
slide as far as possible in the chosen direction until they are stopped by either another tile or
the edge of the grid. If two tiles of the same number collide while moving, they will merge
into a tile with the total value of the two tiles that collided. The resulting tile cannot merge
with another tile again in the same move. Higher-scoring tiles emit a soft glow. The game is
won when a tile with a value of 2048 appears on the board, hence the name of the game.
After reaching the 2048 tile, players can continue to play (beyond the 2048 tile) to reach
higher scores. The maximum possible tile is 131,072 (or 217); the maximum possible score is
3,866,976; the maximum number of moves is 131,038. When the player has no legal moves
(there are no empty spaces and no adjacent tiles with the same value), the game ends.

1.2 Need for the System


2048 is a game; its sole purpose is entertainment. Even though it is just a simple game, it
sharpens the players mind. The challenge of how to win 2048 game has nothing to do with
math. Most people can recognize when two numbers look alike, and all you have to do is
combine them. Theres not a whole lot of actual adding to do. The challenge is in
positioning. You have to move your tiles around constantly so that you can get them to
match, and when you move, your entire tiles move. This makes it pretty tricky to get things
linked up exactly how you want. This isnt your typical sliding puzzle where you can control
the pieces individually. To make it even more complicated, when you move in one direction,
all of the matching tiles will automatically combine. The focus is to develop the thinking
ability of a the user.

1.3 About the Environment


The game is developed for all kind of game loving persons. The game is quite easy and with
simple interface. Let it be a student, a middle aged person or even a aged person all can
enjoy this game. This games is based on numbers and its multiplication system. The user
will be able to improve his mathematical abilities.
For younger kids it will help in their education, and more over as it is a game they will be
interested more. It concept can also be used to conducting tournaments where winner can be
selected based on high score.
It will reduce the mind stress and is also used to improve our mathematical thinking
logic. It is used to improve presents of mind of a person. The challenge might be good
opportunity to check my Swift skills and to make me more confident about it.used to
improve ones game strategy and it also used in real life. The game increases ones predictive
thinking capability.

1.4 Salient Features of the System


The game is a number based game. So it will improve ones ability with numbers. The
whole concept is about shifting of tiles and making a multiple of 2. It is a strategy game with
simple controls. The goal is to get the final value that is 2048 in the final round that too by
maintaining a high score. It is compatible with both pc base system and also with smart phones.

2. SYSTEM STUDY AND ANALYSIS


2.1Existing System
Same game is already existing, The newly developed version is has upgraded features.
This game is available for every environment. Can be found in any play store. If there is any
wrong play or illegal move, no dialog box or message box is displayed to guide the player for
further continuation of playing the game. Help menu is not available in the game, so the user
feels difficult to play the game for the first time. Once we exit the game, it cannot resume the
game from where we exit.
Drawbacks of Existing System
The existing system has following disadvantages,
It not provides the all-time high score of the player.
Offline game.
Single player game.

2.2Proposed System
2048 is a brain teasing puzzle game that is fun and easy to learn! If you are into brain-stimulating
games that really test your skills in both puzzle and math, then you're going to really love 2048!,
2048 is not only one of the most challenging games out there, but one of the first in its category!
There is really no other game like 2048! Move your numbers around a square to get higher than
2048. Try different moves and positions to get all the blocks to equal to 2048. It's not as easy as
you think. Each time you think you've got it, you're barely even close to reaching 2048--let alone
surpassing that number! If you find yourself having trouble reaching the top score, 2048
Strategy has you covered with all the answers, cheats, tips, hints, and strategies you need to get
2048 and higher!

2.4System Description
The system is is used to improve presents of mind of a person. And the above drawback are
modified and corrected for the further use of the game. This system is a mobile application one,
where all the limitations of manual system are compensated. This game provides the User to
increase the thinking capability. It has a best UI design for users. It have help menu for the users
sometimes the users can know how to use this application.

2.5 Software and Hardware Requirement


Hardware Requirements
Processor

Core2Duo 2.9 GHz

RAM

2 GB DDR

Memory

320 GB HDD

MONITOR

17inch Color

KEYBOARD :

108 keys

MOUSE

Optical Mouse(2 buttons)

Device

Smart phone.

Operating System

Windows 7 Ultimate

Developing tools

Java eclipse(juno)

Software Requirements

Java Programming Language


The java programming language is a high-level language that can be characterized ball of the
following buzzwords:
Simple
Architecture neutral
Object oriented
Distributed
High performance

Interpreted
Multithreaded
Robust
Dynamic
With most programming languages, you either compile or interpret a program so that you can
run it on your computer. The Java programming languages unusual in that a program is both
compiled and interpreted. With the compiler, first you translate a program into an intermediate
language called java bites code the platform-independent codes interpreted by the interpreter on
the Java platform. The interpreter parses and runs each Java byte code instruction on the
computer.
The Java Platform
A platform is the hardware or software environment in which a program runs. Weve already
mentioned some of the most popular platforms like Windows2000, Linux, Solaris, and Mac OS.
Most platforms can be described as a combination of the operating system and hardware. The
Java platform differs from most other platforms in that its a software-only platform that runs on
top of other hardware-based platforms.
The Java Platform Has Two Components:

The Java Virtual Machine (Java VM)

The Java Application Programming Interface (Java API)

The Java API is a large collection of ready-made software components that provide many useful
capabilities, such as graphical user interface (GUI) widgets.
My Program.java
Java API
Java Virtual Machine
Hard ware-based platform

What can java technology do?


The most common types of programs written in the Java programming language are applets and
applications. If youve surfed the Web, youre probably already familiar with applets. Applet is a
program that adheres to certain conventions that allow it to run within a Java-enabled browser.
An application is a standalone program that runs directly on the Java platform. A special kind of
application known as a server serves and supports clients on a network. Examples of servers are
Web servers, proxy servers, mail servers, and print servers. Another specialized program is a
servlet .A servlet can almost be thought of as an applet that runs on the server side. Java Servlets
area popular choice for building interactive web applications, replacing the use of CGI
scripts.Servlets are similar to applets in that they are runtime extensions of applications. Instead
of working in browsers, though, servlets run within Java Web servers, configuring or tailoring
the server. Applet is a program that adheres to certain conventions that allow it to run within a
Java-enabled browser. An application is a standalone program that runs directly on the Java
platform.
Jpanel
JPanel is a public java swing class which is used to create a general-purpose container JPanel
objects that are used to group other GUI components without adding any functionality to the
added components. Panel objects can add color to their background and also can be customized.
JPanel inherits methods from its super classes namely JComponent, Container, and Component
java classes. JPanel is an extension of java swing JComponent class. JPanel class implements
Accessible interface.
Swing was developed to provide a more sophisticated set of GUI components than the
earlier Abstract Window Toolkit (AWT). Swing provides a native look and feel that emulates the
look and feel of several platforms, and also supports a pluggable look and feel that allows
applications to have a look and feel unrelated to the underlying platform. It has more powerful
and flexible components than AWT. In addition to familiar components such as buttons, check
boxes and labels, Swing provides several advanced components such as tabbed panel, scroll
panes, trees, tables, and lists.

Unlike AWT components, Swing components are not implemented by platform-specific code.
Instead, they are written entirely in Java and therefore are platform-independent. The term
"lightweight" is used to describe such an element.
Application Specification
ECLIPSE is an IDE (Integrated Development Environment) that is used to develop the android
application. Eclipse is a multi-language software development environment comprising a
workspace and an extensible plug-in system. It is written mostly in Java. It can be used to
develop applications in Java and, by means of various plug-ins, other programming languages
including Ada, C, C++, COBOL, Fortran, Haskell, Perl, PHP.It can also be used to develop
packages for the software Mathematical. Development environments include the Eclipse Java
development tools (JDT) for Java, Eclipse CDT for C/C++ and Eclipse PDT for PHP, among
others.

3. SYSTEM DESIGN AND DEVELOPMENT


The most creative and challenging phase of the system life cycle is the system design.
Design begins by using identified system problem as a basis for developing objective for the new
system. The primary objective of design phase will always be to design a system, which delivers
the functions required by the client to support the business objectives of their organization. There
are a number of objective, which must be considered if a good design is to be produced.

3.1 Input Design


Input designs the process of converting the user originated input to a computer based
format. The goal of the designing input data is to make the data entry easier, logical and free
from errors.
The input design is prepared in this system in a way the user can instruct the system how he or
she want to play the game based on the protocol of the game.so easy and simple design is to be
implemented.
If data going into the system is incorrect, the processing and output will magnify the errors.
Input data are collected and organized into groups of similar data. The designing of input data is
to make data entry as easy, logical, and free from errors. When designing input, the objective is
to ensure that the data, which will be processed by the system, is collected and entered it into the
system efficiently.
3.2 Output Design
Output is the most important and direct source of information to the user. Efficient and
intelligible output design improves the proposed systems relationship with the user and help in
decision making. Reports should be designed around the output requirements of the user. A
quality output is one which meets the requirement of the end user and which present the
information in a way which is clear, easy to play and visually attractive.
3.3 Code Design

A code is an ordered collection of symbols designed to provide unique identification of


entity or attribute. The coding system should be designed to offer uniqueness, expansibility,
stability, meaningfulness, operability. The code must be simple to apply and easily understood by
each user. The code should be easy to modify to reflect necessary changes in conditions. The
code designs of the proposed system which do not require frequently updated and also promote
user efficiency. The code should be adequate for proposed system and anticipated data
processing both for human and machine use.

3.4 Data flow diagram


Level 0 DFD
Game control

Responds to user

plays with computer

Players

Level 1DFD
User

Select

Selection
Process
Movement of tiles

Random generation (2&4)


Working
Process

3.5 Flow chart


Game start
Arrow key

2+2=4

Start B

4%2==0

No
Yes

Start A

Value==
Tile value
No
Default color

yes
Color

If tile ==2048
Yes

Display

3.6 Test Case Design


Test case design focuses on a set of techniques, which meets all testing objectives, which
are mentioned below.
Testing is a process of executing a program with the intent of finding an error.
A successful test is one that uncovers as yet undiscovered error.
Testing demonstrates that software functions work according to specifications. In
addition data collected from testing provides a good indication of software reliability and some
indication of software quality as a whole. Testing results in the deduction in the numbers of
errors. Critical modules are tested as early as possible.
The following tests have been carried out after developing the system.
Preparation of Test Data
Taking various kinds of test data dose the above mentioned testing, Preparation of test
data plays a vital role in system testing. After preparing test data the under study is tested using
that test data, errors are again uncovered and corrected by implementing the above testing steps
and corrections are noted for future use.
3.7 Module Description
New game
Help
High score
3.7.1 New game
By clicking new game window is opens, here it produces random numbers either

2or4 as a input which starts the game. After that player is going to play the game using the arrow
key
3.7.2 Help
Help is provide the instruction for the users how to use this application and how
to play the game.
3.7.3 High score
Here the high score of the current game is displayed later is updated when another
games score exceeds the current high score

3.8 Development
After the successful completion of the design phase, the next important step, which comes into
account, is the development of the system according to the specified design. The main procedure
of this phase is the coding of the designed system, in order to satisfy the requirements. The
detailed input/output, text manipulation, logic comparison during system analysis stage provides
the input for program preparation. Coding was carried out in a step-by-step manner. One or more
programmers convert these operations into a program of instructions return a language and form
acceptable to the computer hardware. Proper validations are done for every user-defined
function.

4. TESTING AND IMPLEMENTATION


4.1 Objectives of Testing
The implementation phase is less creative than the system design phase. In this phase the system
has been designed and is ready to be implemented. Before implementing a system for real world
applications it should be tested. The system will be tested to find whether it works properly and
satisfy the needs of the user. For this, various methods for testing were done on this system.
This is the final stage of system development and more attention is imperative. System
implementation defines the process of converting new or revised system design is to an
operational one. Here the new system is being implemented.
In this chapter, some of the screens that were designed for user interface are shown. Then
the various types of tests that were done on the system are explained in detail.
4.2 Test Plan
Testing is the vital to the success of the system. System testing makes a logical
assumption that if all the parts of the system are correct, the goal will be successfully achieved.
Its basic function is to find the software by examining all possible loopholes. The goal of the
testing is to point out uncovered requirements, design or coding errors or invalid acceptance or
storage of data etc.
4.3 Testing Methods
The Software Testing process commences once the program is created and the
documentation and related data structures are designed. Software Testing is essential for
correcting errors. Otherwise the program or the project is not said to be complete.
The following are the types of Testing
Program Testing
System Testing
Unit Testing

Integration Testing
User Acceptance Testing

4.3.1 Program Testing


A program represents the logical elements of a system. Program testing checks the two types of
errors such as logic error and syntax error. Syntax error is a program statement that violates one
or more rules of the language in which it is written. Logic error deals with incorrect fields, out of
range items, and invalid combinations. These errors are shown in through error messages
generated by the computer. When a program of the proposed system is tested, the actual output is
compared with the expected output. When there is a discrepancy, the sequence of instructions
must be traced to determine the problem in the proposed system.

4.3.2 System Testing


System testing is designed to uncover weaknesses that were not found in earlier tests.
These include forced system failure and validation of the system, as its users in the operational
environments will implement it. In this total system is also tested for recovery and feedback after
major failures to ensure that no data are lost.

4.3.3 Unit Testing


In this testing each module individually and integrated the overall system. Unit testing
focuses verification effort on the smallest unit of software in the module. This is also known as
Module Testing.
In this System, each and every module has been designed and tested separately to know
their integrity. This testing is carried out during programming stage itself. In this testing step
each module is found to work satisfactory with regards to the expected output from the module.
There are some validations checks are also for fields. It is very easy to system.

4.3.4 Integration Testing


Integration testing is a systematic technique for constructing the program structure while
conducting tests to uncover errors associated with interfacing. The developed system has run

successfully for this sample. The need for integration testing is to find an overall system
performance. The entire system is tested as a whole and the errors are corrected.

4.3.5 User Acceptance Testing


An acceptance test is running the proposed system with live data by the actual user. An
acceptance testing has the objective of the reliability and validity of the system. It verifies that
proposed systems procedures operate to system specifications and that the integrity of vital data
is maintained.

4.3.6 Output Testing


The output of the proposed system is checked whether it is a error free or not. The type of
output, content, format, response of the proposed system is verified.
4.4 Testing In System
All testing methods such as Black box, white box and integration testing have done in
this system. White box testing focuses on internal structure of the component. It covers all
statements, branch, path, condition and dataflow in a program.
Unit testing
Integration testing
System testing
User Acceptance testing
The both functional and structural testing has done in this system. The functional testing
focuses on the input, output behavior of the component. The structural testing focuses on the
internal structure of the component.
The modules in this project has been tested thoroughly and found to be accurate which
can meet the needs on the user. The tested modules are finally combined together into a complete
one. The user acceptance testing is found to be little difficult and the in this project user
satisfaction is obtained.

4.4.1 Unit Testing


Test Case1: Execution of the if statement.
Test Input: User moves the arrow keys.
Test Output: the tile input no%2 condition is checked. That condition is satisfied means
startA will give random value for that condition
Test Output: if condition is not satisfied means, else part will process random value for
that condition
Test Output: After the condition processing, next increment value will displays in the
game window
Test Case2: Execution of tiles increment
Test Input: user moves the arrow keys
Test Output: two same numbered tiles adds up to the nearest tile (2+2=4,4+4=8)like this
event will performed that window

4.4.2 Integration Testing


Test Case1: Merge tile color display
Test Input: merge same number tiles in the tile window
Test Output: 2+2=4, these tiles will merge and the 4 tile color will change by the
conditional (like yellow, red, white colors)
Test Case2: Arrow key movements
Test Input: Right & left arrow key movements
Test Output: this key will help you to move the tiles to right & left of the matrix window
and merge the two equaled tiles.

Test Input: up & down arrow key movements


Test Output: this key will help you to move the tiles to top & bottom of the matrix
window and merge the two equaled tiles.

4.4.3 System Testing


Test Case1: Illegal moves of the user
Test Input: user will clicking the other keys without the arrow keys in the keyboard
Test Output: no action will be done at the game window. then at the game remains at the
game
Test Case2: Press the arrows to merge the cells numbers accordingly
Test Input: Press the arrow key to relevant to the tiles display
Test Output: 2, 2 tiles merge and give the 4 value in the single tile
Test Case3: Satisfied moves in the tiles movement
Test Input: In the 4*4 matrix window 2tile and 4tile will available
Test Output: These two tiles are not equaled values, because of that we couldn't merge the
two tiles.

4.4.4 User Acceptance Testing


Test Case1:Test for game start
Test Input: Double clicking the jar file
Test Output: 4*4 matrix window will open and random value(2 or 4)will appear.
Test Case2: User interaction between the game
Test Input: New game button action
Test Output: this button is used to restart again the new freash window at the processing
time.
Test Input: Help button action
Test Output: This button is used to give the instruction about the game and give usability

of the arrow key


Test Case3: Usage of arrow key movement
Test Input: User will press the arrow key
Test Output: Arrow will need to merge the tiles in the 4*4 matrix window
Test Output: Arrow key movement will generate the new tile value at the unfilled tile
box.
Test Case4: Test for the game end
Test Input: User reaches the 2048 value on a single tile
Test Output:"The message box will shows the message and it will carries the new game
button and keep going button

4.5 Implementation
Implementation is the process of converting a new or revised system design into an
operational one. Thus it can be considered to be the stage in achieving a successful new system
and its vital to assure the user confidence that the proposed new system will never cause impairs
and it will be effective. The implementation is not carefully planned and controlled, it can cause
chaos.
A software application in general is implemented after navigating the complete life cycle
method of a project. Various life cycle processes such as requirement analysis, design phase,
verification, testing and finally followed by the implementation phase results in a successful
project management. The software application which is basically a web based application has
been successfully implemented after passing various life cycle processes mentioned above.
The approaches of implementation are direct, parallel. In the first approach, the existing
system is rejected and the new system is completely implemented.

5. COMPARITIVE STUDY
A lot of games are there in completion with 2048 game. One of which is threes. It is also a
number based game. But it includes numbering of 1 and 3 only. Which when compared to 2048

is quite complicated and reduces the interest of the user. Where as in 2048 as only 2s and its
multiple is used the game is quite exiting and one is able to do mind calculations, which increase
the speed of game play. As the game is faster than Threes the interest of the user to gain higher
score is developed. Thereby increasing competitive mind.
As the 2048 is a matrix format game, applying square of the value is quite easier than applying
complex for odd numbers.

6. CONCLUSION
Todays Modern world Peoples are interested to play computer games, especially puzzles which
enhances their knowledge and their capability of solving the puzzles.

As far as the work done so far much care was given about the user friendliness and a very good
interaction with the end users. The interfaces are designed in such a way that users can never
make any mistake while using the application.
The system is highly user friendly and any one can execute if and get the required results. This
project will certainly fulfill the requirements of the end user without any stress and strain. Hope
this game will be very useful for the people to play games. In addition after completing the game
it will display a motivational message to the user to play the game once again.

7. SCOPE FOR FUTURE DEVELOPMENT


The project has covered almost all the requirements. Further requirements and
improvements can easily be done since the coding is mainly structured or modular in

nature. Changing the existing modules or adding new modules can append improvements.
Further enhancements can be made to the application. In future the game enhanced
from single player game to multiplayer game. In future we can provide a chance of
challenging another player for another game to increase the chance of winning the game.
The project will be more users friendly with the future enhancement of having the
players to give the feedback facility, which will intimate the player has selecting the grade
of the game to the next level. Further, this project can be proposed to use this facility to
make the game a complete one.

8. BIBLIOGRAPHY
Reference Books

Containers:Jframes,Jdialogs,and Jpanels by Coulthard

.P,Farr.G

Website
www.java2s.com
www.sampleprogramz.com/jpanel
www.tutorialspoints/jpanel.com
www.jpanelmenu.com
www.stackoverflow.com

9. APPENDIXE
a. Sample screenshot
Start game:

Tile movement:

b. Sample code
public class Game_Panel extends JPanel implements KeyListener
{
//instance variables
public TILE panel[][];
public byte current_tiles;
public boolean achieved_goal;

public static final int default_start_A = 2;


public static final int default_start_B = 4;
public static final int HW = 489;
public static final int seperation_length = 4;
public static final int block_width = 119;
public static final int block_center = 119>>1;
public static final int RANDOM = 101;
public static final byte ROWS_COLS = 4;
public static final byte real_end = ROWS_COLS-1;
public static final byte fake_end = 0;
public static final byte left_increment = 1;
public static final byte right_increment = -1;

//keyboard ascii numbers


public static final byte LEFT = 37;
public static final byte RIGHT = 39;
public static final byte UP = 38;
public static final byte DOWN = 40;

//x and y positions of the four possible places of a tile.


public static final int JUMPS[] = {seperation_length,
(block_width+seperation_length),
((block_width<<1)+seperation_length),
(((block_width<<1)+block_width)+seperation_length)};

public boolean is_moved = false;


public final Font END = new Font("Lithograph", Font.BOLD, 50);
public static final RenderingHints rh = new
RenderingHints(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);

public Game_Panel()
{
setBackground(BACKGROUND);
setPreferredSize(new Dimension(HW,HW));

setFocusable(true);
requestFocusInWindow();
addKeyListener(this);

rh.put(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
panel = new TILE[ROWS_COLS][ROWS_COLS];
achieved_goal = false;

//same as generate method, but thought it'd be a waste


//to call it when we're initializing.
Random row_col = new Random();
byte row = (byte) row_col.nextInt(ROWS_COLS);
byte col = (byte) row_col.nextInt(ROWS_COLS);
int two_four = row_col.nextInt(RANDOM);

if (two_four % 2 == 0)
{
panel[row][col] = new TILE(default_start_A);
}
else

{
panel[row][col] = new TILE(default_start_B);
}
current_tiles++;
}

public void paintComponent(Graphics g_first)


{
super.paintComponent(g_first);
Graphics2D g = (Graphics2D) g_first;
g.setRenderingHints(rh);
for (byte row=0; row<ROWS_COLS; row++)
{
int Y_jump = JUMPS[row];
for (byte col=0; col<ROWS_COLS; col++)
{
int X_jump = JUMPS[col];

if (panel[row][col] == null)
{
g.setColor(DEFAULT_TILE);

g.fillRoundRect(X_jump, Y_jump, block_width, block_width, 80, 80);


}
else
{
int value = panel[row][col].value;
JLabel temp = panel[row][col].LABEL;

if (value == 2)
{
g.setColor(TWO);
temp.setLocation(X_jump+block_center-18, Y_jump+block_center-20);
}
else if (value == 4)
{
g.setColor(FOUR);
temp.setLocation(X_jump+block_center-18, Y_jump+block_center-20);
}
else if (value == 8)
{
g.setColor(EIGHT);
temp.setLocation(X_jump+block_center-18, Y_jump+block_center-20);

}
else if (value == 16)
{
temp.setLocation(X_jump+block_center-28, Y_jump+block_center-23);
}
else if (value == 32)
{
g.setColor(THIRTYTWO);
temp.setLocation(X_jump+block_center-28, Y_jump+block_center-23);
}
else if (value == 64)
{
g.setColor(SIXTYFOUR);
temp.setLocation(X_jump+block_center-30, Y_jump+block_center-23);
}
else if (value < 1024)
{
g.setColor(REMAINING);
temp.setLocation(X_jump+block_center-45, Y_jump+block_center-20);
}
else

{
g.setColor(REMAINING);
temp.setFont(panel[row][col].big_number);
temp.setLocation(X_jump+block_center-45, Y_jump+block_center-15);
}
g.fillRoundRect(X_jump, Y_jump, block_width, block_width, 80, ;
}

add(temp);

Вам также может понравиться