top of page

Sliding Puzzle Android Application - Android App Assignment Help

Updated: Dec 26, 2021

Sliding Puzzle App


Create a photo sliding puzzle app, to do so you can supply your own photo and divide it into pieces with specified rows and columnsor you can use theimages I have provided for a 4 by 4 puzzle.


You move the pieces around by clicking on them (or touching them on a real device) with your mouse.


Clicking the start button will start a new puzzle, and clicking the solve button will solve the puzzle. To play, you click on a puzzle piece next to the empty block to move.

If you are going to use the provided images, you can find them in images.zip folder.

There are 16 pieces but you can use your own image and slice it to as many pieces as you like and create the puzzle with 25 pieces or 40 pieces for example. That creates a more interesting and more challenging puzzle.


If you want to use your own image for the puzzle, then you have to slice it into pieces. You don’t need a fancy paint program with a built in function for this. The windows Paint accessory can do the job. You can find a tutorial on how to do this here:


In the images that follow, I have created the app using a 4 by 4 board for a total of 16 slots.


One slot is empty and the other slots are occupied by 15 equally sized images. After splitting your image into “n” equally sized pieces discard one of them and randomly place the other “n-1” pieces in the board.


You need to keep track of how many moves the player makes before he/she is able to solve the puzzle.

Also when the player wins, your code should recognize that and should display an appropriate message below the two buttons.

If the player is not able to solve the puzzle, he/she can click the “Solve Puzzle” button to solve the puzzle.

At that time, clicking the “New Puzzle” button creates a new puzzle with placing images randomly on the board again.

The way I tested my code to see if it is able to determine when a player wins, I had my checkWin() function to be called right after clicking the “Solve Puzzle”.

Since once the player clicks the “Solve Puzzle” then the images are in the right positions, if you call your checkWin() function at that time it should be able to recognize that, as if the game has been won.

This way you don’t have to keep playing until you win each time you want to debug your checkWin( ) function!


Of course you have to remove that call once you are done testing, otherwise any time the player clicks the “Solve Button” the game congratulates him/her for winning!!

If the player clicks on a piece which is not on adjacent to an empty space, display the message “Wrong move!” or “Illegal move!” below the two buttons.

Design an appropriate layout for landscape orientation and make sure your player won’t lose his/her data if he/she rotates the device.

What follows are images of this app in action (one possible design):


Portrait:


When the app starts:


After clicking “New Puzzle” button:



Player while playing, 8 moves so far, he/she can solve the puzzle at any point with clicking the “Solve

Puzzle” button:


If player clicks on a piece which is not adjacent to an empty space:


After clicking the “Solve Puzzle”button:


After player solves the puzzle:


Landscape:





If you are looking for Android Project Help or Homework Help? Codersarts Android expert will provide the best quality plagiarism-free solution at an affordable price. We are available 24 * 7 online to assist you. You may chat with us through website chat or email or can fill the contact form.



bottom of page