p. languages: Haxe is quite elegant

January 5th, 2008

I had one evening of time for programming these holidays and I decided to make progress at QUBIDRAW. On my to-do list was to remake QUBI PAIRS game in flash. Now it is very shakily implemented in html+js.

I hadn’t programmed in haxe for more than a month, my mind was clear. I wrote code and it just worked. Code flew together without including the reasoning side of my brain. At the end I looked at it and everything was very neat, clean and minimal. After all the code written in haxe I only now see that Haxe is a very cool language !

I also implemented few paradigms here and there that I learned from FP (functional programming) recently. Immutable data and anonymous functions.

Just some nothing-special snippet of code from Qubidraw Pairs:

var col:Int = 0;
var row:Int = 0;
var getXFromCol = function(i){ return 40 + i * 100; };

for (id in picIds3)
{
	pics.push(new PairItem(app, id, getXFromCol(col), 60 + row * 80));
	col ++;
	if (getXFromCol(col) > 350) { row ++; col = 0; }
}

This code creates PairItem objects (the pictures you have to find pairs) and calculates/puts them into right position. N items per row, until the certain width is filled and then it goes to the next row. A WIP version can be played here.

Read and let read :)
  • del.icio.us
  • Reddit
  • Digg
  • DZone
  • email
  • Facebook
  • HackerNews
  • Twitter
  • StumbleUpon

Leave a Reply