SRL Archive - General

8 Puzzle Solving


Iamadam

2011-05-13 07:42:49

Hey hey
I am currently writing a dungeoneering script, and I need to solve the sliding puzzle (3x3 grid, need to slide each tile to the right place).
I think I'll use A*, but not too sure.

Just wondering if anyone else wants to do this bit for me?
Not sure how many here are capable, its university level programming - but its a great challenge.

The reason I ask is because there are just so many puzzles I need to write solvers for, and it'd be great if someone could lend a hand :)

All I need is the logic. So It needs to receive a state, and output a list of moves to get to the completed state. (Pro-tip: use a long to store the game state, 4 bits for each position).

If anyone can do it, they receive full credit on script release.
Otherwise I'll get around to it.



Just thought you programming junkies might enjoy the challenge :P

weequ

2011-05-13 07:56:15

Sounds like a nice challenge. If I were you I would try it myself.

Flight

2011-05-13 08:00:58

Yeah I can understand you're reluctant to do yet another puzzle solver. :p I'm very sorry but I'm for sure this is out of my ability… Just know we're all proud of your progress. :)

enoyhs

2011-05-13 09:27:58

Ooh, ooh! :)

I want, I want!

I will look into it sometime this evening.

Method

2011-05-13 11:36:53

I take it that you'd want this solver to be written for use in Simba. I wrote one in Java when I was bored about a month ago, but I might look into doing it again with Simba.

Echo_

2011-05-13 12:12:18

You can always look at how it's done in iDungeonPro ;)

Iamadam

2011-05-13 18:32:36

From: Echo_
You can always look at how it's done in iDungeonPro ;)

Nah. Don't even want to open that, just makes what I'm doing cheap if I copy :P

@Method: Yeah, I am awful with PS. This would be a million times easier with OO.

Cool Aide

2011-05-17 23:45:17

When I get some free time, I'll take a look at it.

superuser

2011-05-18 07:46:29

Hi,

What about hashing solutions from all possible initial configurations? I don't think the search will be that big.

edit:

Damn, I quess my suggestion won't work as the empty tile in final position will vary. Seems your best choices
are either A* or IDDFS.

Iamadam

2011-05-18 08:23:33

From: superuser
Hi,

What about hashing solutions from all possible initial configurations? I don't think the search will be that big.

edit:

Damn, I quess my suggestion won't work as the empty tile in final position will vary. Seems your best choices
are either A* or IDDFS.


Empty tile in final position varies?
Eh?

Also, the search is too big to just hash solutions.

superuser

2011-05-18 09:53:51

From: Iamadam
Empty tile in final position varies?
Eh?

Also, the search is too big to just hash solutions.


I mean, if the final position can be either for example

[FONT="Courier New"]123
4 5
678[/FONT]

or

[FONT="Courier New"]123
456
78[/FONT]

or anything between, my suggestion won't work. However, if it's always ended in, say, the latter one, the hash will work.

Iamadam

2011-05-18 21:38:06

Solved.
Used A* algorithm, with NSS as heuristic.