Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

#ActualÁlvaro

Posted 16 December 2012 - 10:30 PM

I do it like this (just a bit more compact):
if (a.dir != b.dir) return a.dir < b.dir;
if (a.startx != b.startx) return a.startx < b.startx;
return a.starty < b.starty;

EDIT: Or even this:
return a.dir != b.dir ? a.dir < b.dir
       : a.startx != b.startx ? a.startx < b.startx
       : a.starty < b.starty;

#3Álvaro

Posted 16 December 2012 - 10:28 PM

I do it like this (just a bit more compact):
if (a.dir != b.dir) return a.dir < b.dir;
if (a.startx != b.startx) return a.startx < b.startx;
return a.starty < b.starty;

#2Álvaro

Posted 16 December 2012 - 10:28 PM

I do it like this (just a bit more compact):
if(a.dir != b.dir) return a.dir < b.dir;
if (a.startx != b.startx) return a.startx < b.startx;
return a.starty < b.starty;

#1Álvaro

Posted 16 December 2012 - 10:27 PM

I do it like this (just a bit more compact):
if(a.dir != b.dir) return a.dir < b.dir;
if (a.startx != b.startx) return a.startx != b.startx;
return a.starty < b.starty;

PARTNERS