3 ms·
The article states the goal to be under 2000 characters, to state it in terms of lines of code (as the submitter has) is kinda misleading when the following is
by benjoffe 16y ago
The article states the goal to be under 2000 characters, to state it in terms of lines of code (as the submitter has) is kinda misleading when the following is considered to be one line:
if(*c-10){K=c[0]-16*c[1]+C;L=c[2]-16*c[3]+C;}else /* parse entered move */
edit: can't see a way to escape asterisk characters, so this outputs slightly wrong (edit2: fixed)
- mathgladiator 16y agovery true. It would be way more impressive to be in 1000 expressions.
- Groxx 16y agoI don't think there is (without what follows)... I've tried a couple experiments, but without adding spaces I don't think it works. (though if you have one * on its own, followed immediately by a space, it keeps the * there). The correct way, though: add two spaces to the front. Then you get mono-spaced font, reproduced verbatim. Kinda like this: **************
- benjoffe 16y agoAh thanks, fixed.
- gcb 16y agouse to find that way of thinking mostly in perl hackers. A pity that people choose to sacrifice a lot of readability just to save a few characters in the source... it's not even justifiable in a interpreted language... in a language that you have to compile it's criminal
- rayval 16y agoThe source is not intended to be readable. The glory is in the 1433 characters total (or 133 lines, if you prefer that metric). Everyone knows that it is artificial, but it does not matter. The spirit is similar to the 10K Javascript contest (see http://10k.aneventapart.com/ http://10k.aneventapart.com/ ) If you want to try to understand the chess code, the author provides an expanded version with comments that is more readable: http://home.hccnet.nl/h.g.muller/maximax.txt http://home.hccnet.nl/h.g.muller/maximax.txt In order to read the code, it is helpful to understand the basic algorithm (recursive negamax search). Here is a good explanation of minimax, negamax and alphabeta: http://www.hamedahmadi.com/gametree/ http://www.hamedahmadi.com/gametree/