Tuesday, May 4, 2021

Images missing again thanks to Google...

Is 2021 and COVID is in the news and my country is in the brink of failure and this blog is mostly dead, but still... I would have prefered these posts of me to remain as a memoir of my past efforts and interests. So is sad to see the images of this blog being lost again. This time it seems it was thanks to Google Sites being deprecated, moved, who knows? (notice the remark here). Something like this happened before with Google++ and the Picasa fiasco. If something, this just confirms that Google is a totally unprofessional company for hosting blogs, so sad that they bought Blogger for dying like this. Maybe I'll have to migrate now to Medium or something similar, but I'm still not feeling like writing like before: real life got really busy and serious here. I'll use the opportunity to wish you well and that things get better for us all. Again, sorry for the missing images, you can still look for some of them in the web archive, ie: dynamic programming

Thursday, February 4, 2016

The zebra puzzle

The Zebra Puzzle is a well-known logic puzzle that can be fun to solve if you are bored.
Try below your logic skills in the interactive version I made. Your objective is to get all the conditions true (green). To change the order of elements just click in the ones to swap consecutively.

If you find yourself struggling or you want an elaborated explanation of how to solve it you can find it here.

Of course this little problem is ripe to be solved with a little help of code, but the naive brute force implementation would take some time to finish; there are (5!)^5 possibilities after all, that is: 24883200000 possible arrangements that we'll need to check.
Here you can find a brute force solution using Web workers, just don't hold your breath.

Some kind of optimizations would be needed to solve this fast. I was planning to post here my crappy constrained generator code until I found this amazing post of some guy that created a whole working online Prolog interpreter to solve this kind of problems. So you better continue there.

Prolog is "the language" to solve these type of problems, here is my solution in case you are wondering:

Just ask for: "puzzle(Houses)" in the online interpreter.

Sunday, April 5, 2015

Little chess timer with Haxe and openfl

I needed a simple chess timer to exercise my rusty chess.
So i did this simple app that you can use to time your games.


The HTML5 version it's here.
The APK for Android is on my dropbox.
For iOS you'll need to build the project, it requires Haxe and openfl.

The app itself is very simple and only has being configured for 5, 10 and 15 minutes games, but you can change that in the source code. Happy games!

Sunday, September 21, 2014

Pascal's triangles in HTML5

I did this animation in Flash long time ago, but I wanted to see it on my iPhone so I ported it to JavaScript using canvas and web audio.

The animation is a Pascal triangle reflected in the X and Y axis, where the empty cells are the numbers that are divisible by some random number (not prime) selected for every drawing pass, and the cells in colors are randomly colored accordingly to their residue by the same random number. The source code has all the nitty-gritty details.


The standalone version with music can be found here.

Sunday, August 24, 2014

Mathematical art

Once upon a time, I considered myself a decent painter. I remember getting second place in some magazine for some Christmas teenagers contest and spending a whole summer painting furiously at my home in the highlands. But, truth be said, I'm awful compared with the professional painters and artists I have found working as a game developer. Most of my art prodigies are forever lost now, maybe for good, but I remember painting something like this when I was entranced on my abstract expressionism period:

Sunday, January 5, 2014

IMO 1979 Problem 3

I "solved" another International Mathematical Olympiads problem:
There are two circles in the plane. Let a point A be one of the points of intersection of these circles.
Two points begin moving simultaneously with constant speeds from the point A, each point along its own circle.
The two points return to the point A at the same time.
Prove that there is a point P in the plane such that at every moment of time 
the distance from the point P to the moving points are equal.
The demo below draws all the lines that satisfy the condition while the points are moving, if there is such a point P then our lines must intersect in that point.

r (R1/R2)
q [R1 - R2, R1 + R2]
Move
Inverse direction
The source code can be found here: http://github.com/ex/js
And the stand alone demo can be viewed here: http://ex.github.io/js/src/imo_1979_3/