Skip to content

Commit

Permalink
initial updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Chen Chen committed Sep 15, 2016
1 parent 4a73853 commit 5b3ec52
Show file tree
Hide file tree
Showing 83 changed files with 6,251 additions and 23 deletions.
695 changes: 674 additions & 21 deletions LICENSE

Large diffs are not rendered by default.

99 changes: 97 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,97 @@
# Number-Slider-Puzzle-Game-App
An simple Java GUI app illustrating the principle of MVC (Model-View-Control) model
# Desktop Based Number Slider Game Application
A Java GUI implementations of revised traditional number slider game application based on Model-View-Control (MVC) pattern.

## Table of Contents:
* [Credits](https://bitbucket.org/chenchenece/number-slider-puzzle-game-app/overview#markdown-header-credits)
* [Project Information](https://bitbucket.org/chenchenece/number-slider-puzzle-game-app/overview#markdown-header-project-information)
* [Design Idea](https://bitbucket.org/chenchenece/number-slider-puzzle-game-app/overview#markdown-header-design-idea)
* [Gaming Rule and Game Panel](https://bitbucket.org/chenchenece/number-slider-puzzle-game-app/overview#markdown-header-gaming-rule-and-game-panel)
* [Information Panel](https://bitbucket.org/chenchenece/number-slider-puzzle-game-app/overview#markdown-header-information-panel)
* [Control Panel and Menu Bar](https://bitbucket.org/chenchenece/number-slider-puzzle-game-app/overview#markdown-header-control-panel-and-menu-bar)
* [Exceptions](https://bitbucket.org/chenchenece/number-slider-puzzle-game-app/overview#markdown-header-exceptions)
* [References](https://bitbucket.org/chenchenece/number-slider-puzzle-game-app/overview#markdown-header-references)

## Credits

* [Dr. Kristof Cools](http://www.nottingham.ac.uk/engineering/departments/eee/people/kristof.cools)
* All teaching assistant of Web Based Computing (H63JAV) (Spring 2016) (University of Nottingham)

## Project Information

The mission of this desktop GUI number slider puzzle game application is to generate a shuffled number slider puzzle game and allow users to solve it by sliding numbered block to limited empty space with minimal moves and time.

This application is highly flexible being able to generate puzzle with customized difficulty level and puzzle size. The general main UI panel can be seen as follows, which consists of four main parts: the menu bar, the game panel, the information panel and setting panel.

![GUI_interface.JPG](https://bitbucket.org/repo/nLdgk7/images/1887326757-GUI_interface.JPG)

As a summary, the features of these four main parts can be listed as follows:

Area | Feature
:----- | :-----
Menu Bar | Quick helps, Share, Print puzzle, Exit;
Information Panel | Puzzle size, Memory status, Current time, Time elapsed, Number of shuffles;
Setting Panel | Time elapsed displaying, Reshuffling, Restart, Pause, Resume, Save, Exit;

## Design Idea

In this app, the idea of Model-View-Control (MVC) is fully applied [1, 2], which can be abstracted as follows.

![design_idea.JPG](https://bitbucket.org/repo/nLdgk7/images/4131596285-design_idea.JPG)

### View:

This package is mainly composed of three basic panels (i.e. game panel, information panel and setting panel) and main frame window;

### Model:

This package is mainly composed of puzzle model and block model, such that the GUI interface can be updated while the background calculations can be executed.

## Gaming Rule and Game Panel

The game panel is defined as the area where users are able to slide numbered block by left clicking relevant tiles.

The goal is to solve the shuffled number slider puzzle by moving blocks into empty space with multiple steps. An example size 4 unsolved and solved number slider puzzle can be referred as follows.

![logic.JPG](https://bitbucket.org/repo/nLdgk7/images/3676167309-logic.JPG)

After successfully finishing current round of game, a new game puzzle with increased puzzle size will be generated whose difficulty level is automatically enhanced. This process will continue until the puzzle size reaches 10 which are considered as the maximum size of this app.

## Information Panel

The features of various areas can be summarized as follows:

Item | Prompted Info | Notes
:--------- | :----- |:-----
Puzzle Size | Number of row and column of generated square size puzzle. | This value can be modified by users which are suggested between 2 to 10 (the large value, the higher challenge).
Number of Shuffles | Number of shuffles for generating puzzle. | This value can be modified by users which are limited between 10 and 1010 (the large value, the higher challenge). And the value can be input by either typing or dragging slider.
Moves | Numbers of moves users have been made. |This value will be reset to 0 when reshuffled or start a new game.
Time Elapsed | Seconds elapsed since first move being made. | This value can be hid by clicking ‘Not Show Timing’, which may be recovered by clicking ‘Show Timing’.
Current Time | Display system date and time |
Available Memory | Indicate real-time memory information | This feature is designed for software developer for future application development.

## Control Panel and Menu Bar

The features of various areas can be summarized as follows:

Button | Features
:--------- | :-----
Not Show Timing | Hide time elapsed information.
Show Time | Show time elapsed information.
Reset/Reshuffle | Reshuffle current game without changing puzzle size.
Restart | Reset puzzle size to 2 and restart the game.
Pause |Pause the game temporary including elapsed timing feature.
Resume |Resume the game from last state.
Exit |Terminate and exit the program.
Save |Output game result to a file and export the file to designated location.

## Exceptions

The possible exception condition which may occur due to unexpected reasons and operations such as wrong characters input can be summarized as follows. Several possible exception handler are implemented in the app.

![exceptions.JPG](https://bitbucket.org/repo/nLdgk7/images/278871972-exceptions.JPG)

## References:

[1] O. Astrachan (2003), "Course notes of MVC", Computer Science at Duke University, [Online], Available at: <[https://www.cs.duke.edu/courses/cps108/spring03/notes/slides10-4up.pdf](https://www.cs.duke.edu/courses/cps108/spring03/notes/slides10-4up.pdf)> [Accessed on 5 April 2016]

[2] Google Developer (n.d.), “MVC Architecture”, [Online], Available at: <[https://developer.chrome.com/apps/app_frameworks](https://developer.chrome.com/apps/app_frameworks)> [Accessed on 5 April 2016]
Empty file added backup.txt
Empty file.
73 changes: 73 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<!-- By default, only the Clean and Build commands use this build script. -->
<!-- Commands such as Run, Debug, and Test only use this build script if -->
<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
<project name="NumberSliderPuzzleGameApp" default="default" basedir=".">
<description>Builds, tests, and runs the project NumberSliderPuzzleGameApp.</description>
<import file="nbproject/build-impl.xml"/>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-jar: called before JAR building
-post-jar: called after JAR building
-post-clean: called after cleaning build products
(Targets beginning with '-' are not intended to be called on their own.)
Example of inserting an obfuscator after compilation could look like this:
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Another way to customize the build is by overriding existing main targets.
The targets of interest are:
-init-macrodef-javac: defines macro for javac compilation
-init-macrodef-junit: defines macro for junit execution
-init-macrodef-debug: defines macro for class debugging
-init-macrodef-java: defines macro for class execution
-do-jar: JAR building
run: execution of project
-javadoc-build: Javadoc generation
test-report: JUnit report generation
An example of overriding the target for project execution could look like this:
<target name="run" depends="NumberSliderPuzzleGameApp-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that the overridden target depends on the jar target and not only on
the compile target as the regular run target does. Again, for a list of available
properties which you can use, check the target you are overriding in the
nbproject/build-impl.xml file.
-->
</project>
4 changes: 4 additions & 0 deletions build/built-jar.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#Sat, 30 Jul 2016 10:57:45 +0800


C\:\\Users\\CHEN\ CHEN\\Documents\\GitHub\\Number-Slider-Puzzle-Game-App=
Empty file.
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
36 changes: 36 additions & 0 deletions build/classes/numbersliderpuzzlegame/view/GamePanel.form
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8" ?>

<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<Properties>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[500, 500]"/>
</Property>
</Properties>
<Events>
<EventHandler event="mousePressed" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="formMousePressed"/>
</Events>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>

<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="400" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="300" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Form>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 5b3ec52

Please sign in to comment.