Miscellaneous Ruby: Progress

< 1 >

N-puzzle uploaded

I have now uploaded an n-puzzle implementation in Ruby that includes the items I were talking about in a previous news entry.

The solver is not especially good yet though. I did not want to give the computer a specific algorithm, as that would be boring. Instead I implemented the A* search algorithm to let the computer find a solution itself. It solves 3x3 puzzles without a problem, but 4x4 is usually too large for it. I have begun experimenting with giving it hints of what it could do (e.g. concentrate on solving the first row/column and then solve the resulting subproblem) but it hasn't been especially successful yet.

In any case I feel that I have gotten my feet wet when it comes to Ruby and that I might use it "for real" in some future project.

Exploring Ruby

Ruby is a nice little language that I have begun exploring. Mainly to get a break from Java, which I'm a bit tired of after having spent most of the recent half year working on DKP Log Parser and related projects.

To get used to Ruby I have implemented a command-based version of the 15-puzzle. It went quite painless and the result has been uploaded to miscellaneous Ruby. The project will host various minor test-programs, just like all the other "miscellaneous <language name>" projects. I'm looking to make the following improvements to the currently uploaded implementation:

  • Make it a generalized N-puzzle.
  • Create a better initial state generator. It currently just takes the completed state and then applies random operations to it rather than directly creating a random solvable state.
  • Create a solver (not optimal though, because that's NP-hard).
< 1 >