Wednesday, February 9, 2011

Solving the Tic-Tac-Toe game, finally...

The simple game that has been always after me laughing at my programming incompetence.

The very first time I tried to make a program that could play perfectly the game was in the university, after taking my very first course in Programming Languages (I learned Pascal). It was holidays and I was visiting my cousin and got the nice surprise of him getting a personal computer. It was a powerful 286 with a monochrome amber monitor. I couldn't find anything similar but for you to get the idea, games were played like this in those computers:

Saturday, January 15, 2011

Flasic: a very simple BASIC interpreter for Flash

I just found this very little cute BASIC interpreter: Jasic and I decided to make a port to Flash in order to add basic graphics commands (just "setcolor" and "putpixel" actually) so I could see the little thing drawing a colored Mandelbrot fractal. It was very easy, thanks to the profusely commented code of the original author (Bob Nystrom). You can select the program demos from the drop-down menu and press the [Run] button to start the interpreter. So without further ado, Flasic:

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.

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:

Sunday, April 11, 2010

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.