# Solving a 5x5 sliding puzzle.

Page 1 of 1

## 8 Replies - 9565 Views - Last Post: 21 June 2011 - 06:08 AMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=236410&amp;s=8c6dcc934f2e4ec72a7ff454fedff11a&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 Ethan_Hailey

• New D.I.C Head

Reputation: 0
• Posts: 4
• Joined: 20-June 11

# Solving a 5x5 sliding puzzle.

Posted 20 June 2011 - 03:22 PM

Hello, I have absolutely NO idea how to go about solving one of these puzzles.

I have used Google extensively and have found out a few different algorithms such as A*, and a few others.

What I'm trying to ask is: How would I solve a 5x5 slider puzzle using Java?

If you don't know what a 5x5 slider puzzle is I can explain it.

Note: I'm not asking for the code, I just want to know how I would go about solving one of these puzzles.

Thanks,

Ethan

Is This A Good Question/Topic? 0

## Replies To: Solving a 5x5 sliding puzzle.

### #2 maniacalsounds

• D.I.C Regular

Reputation: 118
• Posts: 474
• Joined: 27-June 10

## Re: Solving a 5x5 sliding puzzle.

Posted 20 June 2011 - 03:23 PM

I would suggest creating a multi-dimensional array and creating a method to solve it thoroughly.
Was This Post Helpful? 0

### #3 Ethan_Hailey

• New D.I.C Head

Reputation: 0
• Posts: 4
• Joined: 20-June 11

## Re: Solving a 5x5 sliding puzzle.

Posted 20 June 2011 - 03:25 PM

maniacalsounds, on 20 June 2011 - 03:23 PM, said:

I would suggest creating a multi-dimensional array and creating a method to solve it thoroughly.

I know that

I just have know clue how I would go about making the method to solve it.

This post has been edited by Ethan_Hailey: 20 June 2011 - 03:25 PM

Was This Post Helpful? 0

### #4 smohd

• Critical Section

Reputation: 1820
• Posts: 4,627
• Joined: 14-March 10

## Re: Solving a 5x5 sliding puzzle.

Posted 20 June 2011 - 03:51 PM

I dont know this game, but since you have got the algorithms from google, as you said, you can implement them, is`nt it? If you need more help please specify algorithm which you have so we can show you the way(also how the game works )
Was This Post Helpful? 0

### #5 Ethan_Hailey

• New D.I.C Head

Reputation: 0
• Posts: 4
• Joined: 20-June 11

## Re: Solving a 5x5 sliding puzzle.

Posted 20 June 2011 - 04:06 PM

smohd, on 20 June 2011 - 03:51 PM, said:

I dont know this game, but since you have got the algorithms from google, as you said, you can implement them, is`nt it? If you need more help please specify algorithm which you have so we can show you the way(also how the game works )

Here is a picture of the game: http://www.tilepuzzl...es/outline2.gif

To play it you have to move all of the tiles into their correct positions to form a picture.

There is one empty space to allow you to slide the different tiles around. Note that you will have a picture of the finished puzzle.

EDIT: Apparently the algorithms that would be used are A* and a few others, but I have absolutely NO clue how these algorithms work or would be implemented.

This post has been edited by Ethan_Hailey: 20 June 2011 - 04:07 PM

Was This Post Helpful? 0

### #6 pbl

• There is nothing you can't do with a JTable

Reputation: 8362
• Posts: 31,955
• Joined: 06-March 08

## Re: Solving a 5x5 sliding puzzle.

Posted 20 June 2011 - 06:44 PM

Googled sliding puzzle algorithm

http://www.8puzzle.c..._algorithm.html
Was This Post Helpful? 0

### #7 Ethan_Hailey

• New D.I.C Head

Reputation: 0
• Posts: 4
• Joined: 20-June 11

## Re: Solving a 5x5 sliding puzzle.

Posted 20 June 2011 - 07:03 PM

pbl, on 20 June 2011 - 06:44 PM, said:

Googled sliding puzzle algorithm

http://www.8puzzle.c..._algorithm.html

Yes, I saw this while searching too. I still have absolutely no clue how I would implement this into my code.
Was This Post Helpful? 0

### #8 pbl

• There is nothing you can't do with a JTable

Reputation: 8362
• Posts: 31,955
• Joined: 06-March 08

## Re: Solving a 5x5 sliding puzzle.

Posted 20 June 2011 - 07:09 PM

Googled sliding puzzle algorithm java

http://www.leepoint....lidepuzzle.html
http://www.javaonthe.../technical.html

What else do you want ?

This post has been edited by pbl: 20 June 2011 - 07:14 PM

Was This Post Helpful? 0

### #9 macosxnerd101

• Games, Graphs, and Auctions

Reputation: 11315
• Posts: 42,625
• Joined: 27-December 08

## Re: Solving a 5x5 sliding puzzle.

Posted 21 June 2011 - 06:08 AM

Can you clarify what you aren't understanding? Do you not understand how to create a method, OOP, the A* algorithm, etc.? What do you need us to better explain? Please be specific.
Was This Post Helpful? 0

Page 1 of 1

 .related ul { list-style-type: circle; font-size: 12px; font-weight: bold; } .related li { margin-bottom: 5px; background-position: left 7px !important; margin-left: -35px; } .related h2 { font-size: 18px; font-weight: bold; } .related a { color: blue; }