For Programmers: Free Programming Magazines  


Home > Archive > Java Help > October 2006 > 15-puzzle usr interface/solving algorithm design









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author 15-puzzle usr interface/solving algorithm design
OkashiiKen

2006-10-21, 3:44 pm

I havent coded in java for about 5 months, so I decided to pull out an old school project and try and make some improvements.

I am working on rebuilding a user interface for a 15-puzzle game. Currently, the gameboard is created using formatted JButtons each with a title string reading "1" to "15" and a " " for the empty box. In order to "move" the boxes i wrote a method that swaps the titles of the boxes and then repaints the frame. In retrospect, I am wondering if this was a bad way to implement the game pieces. I could have done it by drawing shapes onto the JFrame, but that seemed much more difficult at the time. Any suggestions on how to do this better? Especially since I was planning to look into changing the game board into a picture as opposed to numbered buttons.

I am still working on debugging the heuristic i am using to automatically solve the puzzle. The puzzle was initially supposed to be solved using a DBS, but I never got that to work properly as i couldnt avoid all the cyclic traps. If anyone would like to explain how to implement a DBS to solve a 15-puzzle, or even about various heuristics for solving the 15-puzzle, Id be interested.

Thanks.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com