Sunday, August 8, 2010
Solving the Princess in a Box Puzzle
We can solve the puzzle of my last post using a Breadth-first search (BFS) algorithm. The key idea is to realize than the problem is just a Shortest Path problem where the graph, even when it is not completely known at the beginning (because we don't have the graph's adjacency list or adjacency matrix), can be built joining the states the board takes after every movement. The image below can help to understand this. It shows some of the states the board cab take after some movements starting from the beginning.
Labels:
algorithms,
puzzles
Thursday, July 29, 2010
The Princess in a Box puzzle
Today was holidays here (national day) so I finally could finish the Professor Layton and the Curious Village cute little game. If you like puzzles there are no better games than the Professor Layton series. I really recommend them if you own a Nintendo DS. However I don't play games much, so take my advice with a bit of salt: the only games I ever finished were StarControl II, Starcraft and Jeanne d'Arc. That reminds me that the last time I went to Buenos Aires I brought with me a little box with a similar puzzle. I totally forgot about it until I saw again a similar puzzle in the DS game.
This puzzle has been a long time around us as a member of the family of sliding puzzles and is better known as the Klotski puzzle, but I'm going to name it here The Princess in a Box puzzle because is the name that it has in the Professor Layton's game. I did this Flash demo if you want to play it:
This puzzle has been a long time around us as a member of the family of sliding puzzles and is better known as the Klotski puzzle, but I'm going to name it here The Princess in a Box puzzle because is the name that it has in the Professor Layton's game. I did this Flash demo if you want to play it:
Sunday, April 11, 2010
My very own programming font
I think fonts are the second best friends of programmers.
Labels:
programming fonts
Sunday, February 7, 2010
Simple Tetris Clone (FLEX version)
I added to my Tetris clone a FLEX branch, it only uses the compiler and not the FLEX class containers (unnecessary for this little game). The point is you can use the free API tools to make a simple game like this, without needing the Flash IDE at all.
Monday, February 1, 2010
The Pascal's triangle
It was already time to change the animation for this blog, (the little thing at the right, now with a chess board), so I would do a very short description of the previous one here:
This animation is just a Pascal's Triangle (reflected in the four quadrants) with different colors for cells accordingly to their modules with some random number not prime that changes with every iteration. The triangle for the next iteration is drawn row by row, while the previous one is faded. Empty spaces are cells that are divisible by the selected random number.
If you feel more interested, you could check the section 2.3 of the book Chaos and Fractals (Springer) that gave me the inspiration for this. NOTE: I updated this animation to use canvas HTML5 but the old Flash source code is here
Have a nice night!
If you feel more interested, you could check the section 2.3 of the book Chaos and Fractals (Springer) that gave me the inspiration for this. NOTE: I updated this animation to use canvas HTML5 but the old Flash source code is here
Have a nice night!
Thursday, January 7, 2010
Simulator for a basic computer
This is simple simulator for the basic computer described in the book of Morris Mano "Computer System Architecture". Here professor Hyunsoo Yoo maintains a succinct but complete description of this computer, check it if you can't find the book. In special look for the lectures 5 (Basic Computer Organization and Design) and 6 (Programming the Basic Computer) that this simulator uses as foundation.
Subscribe to:
Posts (Atom)