Professional Documents
Culture Documents
Mad Micro Project
Mad Micro Project
Mad Micro Project
ON
SUBMITTED BY
Karan sathe.(40)
Under Guidance of
Certificate
1 Introduction
2 Approach
3 Design
4 Novelty
5 Baised Dice
6 Escape snakes
8 App Requirements
9 How to run
●Snake and Ladder
1.Introduction :
The Snakes & Ladders is an automated version of the
Android game based on the traditional variant of the original Snakes & Ladders Ludo Board
Game. The game has multiple levels with increasing difficulty challenge. The game also has two
Player Modes:
Against Computer
A multiplayer game
2. Approch :
The game is a variant of the original game so it has the following set of
rules:
If either of the two players end up on the same position at the same time, the latter one
will occupy that position and former has to retreat 3 positions.
Either of the player can have a max of 1 retake on a draw of 6. If another six occurs, the
max it will move is 12.
Since the game is implemented in Java, it uses the Java Canvas library for the rendering of the
board. The items on the board are set using custom mathematical functions to position the
screen objects on the board. It uses android studio’s built in activity designer to design the UI.
The game is controlled by multiple classes. Using the object oriented paradigm, the following
classes are included in the game (a brief skeleton):
Player
gender
Ladder
{
ladderNum : Ladder id
GamePanel
Used to meet and initialize android dependencies to be used elsewhere. For more details, please
see Java Doc.
Board{
• Extends Android’s View Class
• The actual Game board is built using this class.
• For complete details please see Java Doc.
e.g angle = arcTan(Height B/w blocks x,y / Width B/w 2 blocks x,y )
Dice {
Num : Stores the outcome it produces
Rand : An instance of Java’s Random Data type
GameManager {
*for complete doc please see Java Doc File*
• Extends Activity class of Java.
• Responsible for Running and creating the activity.
• Initializes instances of all the objects.
• Sets the layout of the Activity using the Board Class Object and
Android Layout.
• Checks if Roll The Dice button is Pressed or if it should be enabled
• Rolls the dice, updates the position and checks the turn of the player
checkPosition() : Checks if the players are on the same position and
takes necessary action as per the rules.
checkWinner() : Checks if either of the players have reached 100 to
declare a winner.
checkBlock() : Check if the players have stepped on a snake or a
ladder and take necessary action as per the rules.
}
4. Novelty :
The design uses the FlyWeight Software Design Pattern (as Canvas is being used ) to render the
blocks as well as the snakes and ladders. This increases the game performance incredibly
thereby reducing the impact on the GPU, hence eating up less battery power.
The 80% Win Probability in higher levels for the Computer is maintained using two approaches:
5. Baised Dice :
The dice when rolled for the computer produces more 6s than the human player i.e the Dice’s
2,3,4 are occasionally considered 6.
6. Escape snakes :
When nearing a block which contains a snake, the computer will
check and avoid it. This is done in the update position (updatePos) function of the player object.
As the SNAKE_LIST is public, the Player Class can access it and check the position of the
upcoming snake and avoid it.
Learnt how the threads in Java work and how to implement concurrency control and
avoid race conditions.
Allowed to be comfortable with the Android IDE and understand the working
components of Android applications.
Allowed us to get familiarized with Android jargons and terminologies.
Understood what the Activities are and how they communicate with each other using
Intent functionality.
Understood and learned various Java and Android specific dependency problems as well
as methods and how to solve and implement them. Also learnt how to handle various
android exceptions.
Understood how the touch input in smartphones work and learnt how to implement
various functionalities using it.
Got familiar with Android Canvas Library and understood most of its tools and methods.
8.App Requirements:
The app is recommended to run on Android API
22 (Lollipop 5.1).
The max supported is Android API 25 (Nougat 7.1)
The minimum supported is Android API 15 ( Ice Cream Sandwich 4.1.x).
All the libraries and dependencies are included in the project folder. The app uses the Java Unit
test framework JUnit version 4.12.
9.How to run :
Just Install the APK file on any Android OS.
To Compile it from source, open the project file in Android Studio. Built the gradle scripts
and run.
To view Java Docs, open the index.html file in the Java Docs folder