Javascript

Code Golfing

Thursday, August 9th, 2012

Recently I was directed the the code golf on stackexchange: http://codegolf.stackexchange.com/  it’s pretty interesting to read other people submissions. I decided to take a crack at the 12 days of christmas submission http://codegolf.stackexchange.com/questions/4191/12-days-of-christmas-lyrics

 

My answer in JavaScript

 

var l=["first","second","third","fourth","fifth","sixth","seventh","eight","ninth","tenth","eleventh","twelfth","Two turtle doves","Three french hens","Four calling birds","Five golden rings","Six geese-a-laying","Seven swans-a-swimming","Eight maids-a-milking","Nine ladies dancing","Ten lords-a-leaping","Eleven pipers piping","Twelve drummers drumming"];var b = "<br/>";for(var i=0;i<12;i++){var p="On the "+l[i]+"day of Christmas"+b+"My true love gave to me"+b;for(var x=i;x>0;x--)p+=l[11+x]+b;if(i>0)p+="and ";p+="a partridge in a pear tree"+b+b;document.write(p);}

Light Chaser

Saturday, May 12th, 2012

If you havn’t visted http://gamedev.moparscape.org then you probably don’t know that lately I have been working on an html5 javascript clone of a game I used to have as a child called lights out. The game was rather simple all you had to do was turn off all the lights to progress to the next level. Currently the game is a work in progress and has a few minor bugs (don’t try to turn on all the lights) but it is playable. Please let me know if you find any bugs or just want to make some comments on improvements. Also you can view the source on my github account.