Segunda-feira, 9 de Novembro de 2009

Codebits Quiz Challenge #5 and the #4 Winner is....

 

There has been great participation to our Codebits challenges this year!

 

 

To all you guys awaiting, the Codebits Challenge #5 is now online!

 

As a reminder, these challenges work as a qualification round for the SAPO Codebits Quiz show. Last year we had great fun, if you want to know how is it like, check the video.

 

The last codebits quiz had 18 valid answers. The winner is Cláudio Valente,  with an elega^H^H^H esoteric solution using Unicode to include more information per character. Cláudio  managed to get 461 strokes with the following solution:

 

 eval(eval('猽❫⁃⡖楦⡊ℽ湵汬噣汥慲眨䤩㭚⡗絫⁌⡖䨽湵汬㭉㵳整眨䌬㤩㭔㵣牥慴故汥浥湴⠢獣物灴∩㭔⹳牣㵵㭢潤礮慰灥湤䍨楬搨呗欠数木戬愬捖唽≨瑴瀺⼯獥牶楣敳⹳慰漮灴⽅假⽱∻甽唷䩓低㽍䘽戻䐽愻匽挪㘰㭚㵫⡖伽䨮煘煒敳畬琮䍈㭤㵏㡫⡦䄭ㄡ㵦⹎慭教䙗⤮浡瀨欨晁昮㑽⤻甽唷䉹䭷䩓低㽣䠴猽∫搷♳瑡牴䬽∫䐷♥湤䬽∫䐷⬲㌺㔹㨵㤦䵚㵫⡖伽䨮煂祋睘煂祋睒敳畬琻伽伦♏⹃䠻楦⡏噩昨⅏⹰潰噏㵛佝絨㵛崻伮景牅慣栨欨敖栽栮捯湣慴⡥⹐牯杲慭献偲潧牡浗⤻核欨敁儼㵓☦〽㵥穙䑗⤮獯牴⡫⡦ⱥ䅦種汯捡汥䍯浰慲攨敺圩⹭慰⡫⡥噯⡥⹃䠴㜠慴•⭥稷㨠∫攮呩瑬攷⠢⭑⼶〷楮畴敳⥜屮≗坽㭤嬰崦♌⡗㭌⡗㬧㭭㵻䄺∩筲整畲渠∬儺≥⹄畲慴楯渢ⱗ㨢⥽∬䠺≨慮湥氢Ⱬ㨢晵湣瑩潮∬䴺❪獯湔慧㵊∻✬∷∺✫∧ⱱ㨢䝥瑃桡湮敬䱩獴∬∴∺≓楧污∬眺≉湴敲癡氢ⱖ㨢⥻∬夺∮楮摥硏昨∬堺≒敳灯湳攮∬稺∮却慲瑔業攢ⱋ㨢䑡瑥∬∸∺∮晩汴敲⠢紻搽∢㭦潲⡸㴰㭸㱳⹬敮杴栻砫⬩筺㵳學崻爽浛穝㭤⬽牼籺絥癡氨搩'.toSource().replace(/\\u(..)/g,"\\x$1\\x"))+'')

 

As a runner-up we have Luis Neves with 553 strokes, no chinese character was damaged, though:

 

function epg(n,e,m){x=new XMLHttpRequest();x.open('GET','/services.sapo.pt/EPG/Search?q=Duration:[*+TO+'+(m*60)+']&wt=json&rows=99999');x.onreadystatechange=function(){if(x.readyState==4){r=JSON.parse(x.responseText);d=r.response.docs;h=[];k=0;for(i in d){u=d[i];w=u.StartTime;b=u.ChannelName;if((b.indexOf(n)>-1)){for(j in w){g={c:b,t:u.Title,d:u.Duration/60};g.s=w[j].replace(/T|Z/g,' ').trim();if(g.s.match('^'+e))h[k++]=g}}}h.sort(function(a,b){return(a.s<b.s?-1:1)});for(i in h){y=h[i];o(y.c+' at '+y.s+': '+y.t+'('+y.d+' minutes)\n')}}};x.send()}; 

 

Please use the comments in this post to discuss the solutions, as always we are open to discuss any detail or question. 

 


publicado por joaovelhote às 20:08

editado por jac em 10/11/2009 às 13:49
link do post | comentar
|
9 comentários:
De Carlos Rodrigues a 9 de Novembro de 2009 às 20:51
Aww, dammit! And there I was, running around with dynamic script tags and the like to avoit XHR and be able to do cross-domain calls... And there was an in-domain proxy all along.

Well, I learned some stuff anyway. :)


De Anónimo a 9 de Novembro de 2009 às 23:17
well, you could've tested.. All the challenges so far had some 'shortcuts' :)

The most important is that all you guys have fun and learn new stuff.


De chbm a 9 de Novembro de 2009 às 20:53
Pá, o 1o lugar foi para um gajo com 1262 bytes (deve ter um keyboard chines muuuiiiiitaaaa grande para serem 461 strokes) e o segundo para um gajo que usou um proxy escondido para dar a volta ao xss e um query não documentado na API. Bonito.

Tou suficientemente longe do 1o lugar para me poder queixar à vontade mas o 3o e 4o devem tar bem lixados :P


De Anónimo a 9 de Novembro de 2009 às 23:19
Stroke != keystroke. Stroke here is more like in golf.

The question explictly mentions:

The winner is the contestant that writes the javascript program
that successfully fetches the requested data and presents in the requested format in the
shortest possible number of *characters*.


Cláudio gets the epicwin. Anyone opposes?

joaop



De phantas a 9 de Novembro de 2009 às 21:37
Cláudio... dude... wow! Eu esperava que, vindo de ti, o truque fosse de génio, não de expert nos webservices ou JS mas... wow!


De celso a 9 de Novembro de 2009 às 23:31
It's worth mentioning that Cláudio gave a talk on Codebits 2007, precisely about Unicode Poetry http://codebits.eu/intra/s/session/65

Now we know what he meant :)


De Vitor Caneco a 10 de Novembro de 2009 às 00:15
Briliant solution! I'm amazed with that single use :O


De gis a 10 de Novembro de 2009 às 00:15
My 550 solution:

function b(a){z=RegExp;w=i=h=0;t=a.response.docs;p=[];for(;i
[Error: Irreparable invalid markup ('<t.length;i++){r=t[i];j=r.channelname;k=r.starttime;for(;w<k.length;++w)if(z(v).test(j)&&z(y).test(k[w]))p.push({d:k[w],n:j,t:r.title,m:r.duration})}p.sort(function(e,r)e.d>') in entry. Owner must fix manually. Raw contents below.]

My 550 solution:

function b(a){z=RegExp;w=i=h=0;t=a.response.docs;p=[];for(;i<t.length;i++){r=t[i];j=r.ChannelName;k=r.StartTime;for(;w<k.length;++w)if(z(v).test(j)&&z(y).test(k[w]))p.push({d:k[w],n:j,t:r.Title,m:r.Duration})}p.sort(function(e,r)e.d>r.d);for(;h<t.length;)o(p[h].n+' at '+p[h].d.replace('T',' ').slice(0,19)+': '+p[h].t+'('+p[h++].m/60+' minutes)\n')}function epg(n,d,m){g=document;v=n;y=d;s=g.createElement("script");s.src='http://services.sapo.pt/EPG/Search?q=Duration:[* TO '+m*60+']&rows=99999&wt=json&json.wrf=b';window.b=b;g.body.appendChild(s)}


De ncorreia a 10 de Novembro de 2009 às 00:19
Ups... My comment up there.


Comentar post