5 ms·
reminds me of the js1k/2010 #2 winner: http://js1k.com/2010-first/demo/750 http://js1k.com/2010-first/demo/750 This one is playable.
by kristopolous 13y ago
reminds me of the js1k/2010 #2 winner: http://js1k.com/2010-first/demo/750 http://js1k.com/2010-first/demo/750
This one is playable.
- sneak 13y agohttps://en.wikipedia.org/wiki/List_of_burn_centers_in_the_United_States https://en.wikipedia.org/wiki/List_of_burn_centers_in_the_Un...
- eksith 13y agoOuch ;) On a less painful note, these types of scripts that do so much with so little are exactly the type of problem that interest me. I don't even care that I was beaten; I just love the fact that something like this exists. Just goes to show how algorithmic chess can be. And code, no matter how "primitive" will trump neurons when it comes to algorithms.
- cschneid 13y agoPlease don't bring reddit style here. There's plenty of reddit on reddit. This kind of snark detracts from what makes this site good.
- Kiro 13y agoI don't understand.
- gamegoblin 13y agoIn American English, slang for an insult is a "burn". e.g. "You got burned" = "You were insulted" The poster was making a joke that the OP had been insulted because this other JavaScript board is superior or something, hence, he directed him to treatment centers for a "burn". This is very common on reddit.
- ca98am79 13y agoyeah that's really awesome. But you can't castle, and a promoted pawn always becomes a queen
- aidos 13y agoHis 2kb version does everything else. http://nanochess.110mb.com/chess4.html http://nanochess.110mb.com/chess4.html
- auctiontheory 13y agoI beat it! I beat it!
- jmulho 13y agoThe ability to castle is insignificant next to the power of the force.
- aidos 13y agoThat's amazing. It just took me to pieces. As is written here [0] "it’s still strangely humbling to get your arse kicked by 1014 bytes" [0] http://malevolent.com/weblog/archive/2010/09/07/1k-chess-showdown/ http://malevolent.com/weblog/archive/2010/09/07/1k-chess-sho...
- gamegoblin 13y agoI found it extremely novice and beat it in under 20 moves. What is your chess experience?
- aidos 13y agoNot huge. I know how to play, but I haven't played much. I think I'd be able to beat a 1024 byte Go game though :)
- DanBC 13y agoI'd be interested to hear your progress against this 1024 byte chess game. It could make an interesting blog post - each game you play, with some analysis of what you do to try to win and whether that works or not. :-)
- Kiro 13y agoWhat's your experience?
- gamegoblin 13y agoI have played competitively for years.
- ca98am79 13y agoHere is the complete code: for(B=i=y=u=b=i=5-5,x=10,I=[],l=[];B++<304;I[B-1]=B%x?B/x%x<2|B%x<2?7:B/x&4?0:l[i++]="ECDFBDCEAAAAAAAAIIIIIIIIMKLNJLKM@G@TSb~?A6J57IKJT576,+-48HLSUmgukgg OJNMLK IDHGFE".charCodeAt(y++)-64:7);function X(c,h,e,s){c^=8;for(var o,S,C,A,R,T,G,d=e&&X(c,0)>1e4,n,N=-1e8,O=20,K=78-h<<9;++O<99;)if((o=I[T=O])&&(G=o^c)<7){A=G--&2?8:4;C=o-9?l[61+G]:49;do if(!(R=I[T+=l[C]])&&!!G|A<3||(R+1^c)>9&&G|A>2){if(!(R-2&7))return K;n=G|(c?T>29:T<91)?o:6^c;S=(R&&l[R&7|32]*2-h-G)+(n-o?110:!G&&(A<2)+1);if(e>h||1<e&e==h&&S>2|d){I[T]=n;I[O]=0;S-=X(c,h+1,e,S-N);if(!(h||e-1|B-O|T-b|S<-1e4))return W(),c&&setTimeout("X(8,0,2),X(8,0,1)",75);I[O]=o;I[T]=R}if(S>N||!h&S==N&&Math.random()<.5)if(N=S,e>1)if(h?s-S<0:(B=O,b=T,0))break}while(!R&G>2||(T=O,(G||A>2|(c?O>78:O<41)&!R)&&++C*--A))}return-K+768<N|d&&N}function W(){i="<table>";for(u=18;u<99;document.body.innerHTML=i+=++u%x-9?"<th width=60 height=60 onclick='I[b="+u+"]>8?W():X(0,0,1)'style='font-size:50px'bgcolor=#"+(u-B?u*.9&1||9:"d")+"0f0e0>&#"+(I[u]?9808+l[67+I[u]]:160):u++&&"<tr>")B=b}W()
- kayoone 13y agohow do they do this ? do they write it in normal JS and optimze the hell out of it in terms of size? Is it some kind of special compiler or all done by hand ?
- Nilzor 13y agoA combination, I suppose. First optimize the code so that the number of instructions are kept to a minimum and then use a minifier tool to shorten variable names and such. http://compressorrater.thruhere.net/ http://compressorrater.thruhere.net/
- StavrosK 13y agoHow the hell does the AI work? It can't be included in that 1 kb, surely!
- gamegoblin 13y agoOne can write a decent negamax AI in < 10 lines of code.
- ybaumes 13y agoIt seems to me it is not a "real" AI. I began a game, and after complete development on my side (about 5-6 moves), the opponent AI did only developed pawns, which shows off its limits. I am not a javascript expert. but given the size of the code, I doubt there is a great IA underluying. Actually I've browsed the mignified code in order to find the AI implementation. The only clue I spot was a call to the Random() function. I won't state it for sure, because I wasn't able to understand the whole code. But I highly guessed it is the basis of the AI implementation. :-)
- djrconcepts 13y agothanks for sharing. i hope in the next version, castling the king is added.
- zem 13y agoi love how he named his function arguments (c,h,e,s). nicely artistic touch.