Skip to content

Instantly share code, notes, and snippets.

@jamescookie
Last active August 29, 2015 13:55
Show Gist options
  • Save jamescookie/8721903 to your computer and use it in GitHub Desktop.
Save jamescookie/8721903 to your computer and use it in GitHub Desktop.
Obfuscated fizzbuzz in groovy
def l=_=1,t,u,v;char p,e,d,a,r=y=100;_=++l++;r-=l;_*=++l;a=r+(l*_)+1;p=y-l+--_;(e,d)=[p+l,a+_];t=/$d$d/;u=''+p+e+t;v=''+r+a+t;for(O in 1..y){println((1>(O%_)&&(O%l)>0)?u:(1>(O%l)&&1>(O%_))?u+v:(1>(O%l)&&(O%_)>0)?v:O)}
//or in as few characters as possible:
//for(i in 1..100){println "${i%3?'':'Fizz'}${i%5?'':'Buzz'}"?:i}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment