diumenge, gener 18

 

Playing Games

Yesterday, I started to play a game on my wii called safecracker. It basically consists on solving some puzzles.

After doing 3 or 4 puzzles, I started a puzzle but couldn't finish it as I don't like to spent too much time on every puzzle.

So I though I better bruteforce it. The puzzle basically consist on a magnetic ball, some walls and some holes. All you have to do is put the ball in one hole. But you only can move up, down, left, right with four buttons and if there's no wall you just fall off the board and you have to start over again.



So I just did a little program to help me with this task. It's quick and dirty and ...well has some ugly hacks because I was too lazy to do it the right way as it would take more time...so be careful with the Stack Overflows as I was too lazy to avoid loops...

So...here's again the puzzle:
------X-----X--------X---
---XX-----X--------------
------------------X------
----------------X-----X--
--C----------XX-C--X-----
----X-O------------------
---------------X---X---X-
------X------X-----X-----
--X---------X------------
------C--X----X--X------X
--------------X-----XX---
X------------X-----------
---X---------------------
-----X-------------C-X---
--X-------------X----XX--
-------------------------
---------------X---------
----X---------X----------
------------X---X--------
-----------------------X-

and one solution, the shortest :)

Solution:
UP RIGHT DOWN LEFT DOWN RIGHT DOWN LEFT UP RIGHT UP RIGHT UP RIGHT DOWN RIGHT DOWN LEFT UP RIGHT DOWN

and here's the code:

Main.java
Table.java
Cell.java
Solver.java
SegMov.java
Position.java
Moves.java

UPDATE: Improved the code a bit and added license

Etiquetes de comentaris: , ,


Comentaris:
Nice game :)
 
Publica un comentari





<< Pàgina principal

Subscriure's a Missatges [Atom]