Hi, a year ago I won the 2005 Best Game categoryof the International
Obfuscated C Code Contestwith a chess program. http://www.ioccc.org/whowon2005.html http://www.mailcom.com/ioccc/toledo/hint.htmBut this post is because I
have discovered (asurprise for me) that it is also the worldsmallest
chess program written in C language.It has a size of 3004 bytes, or
2261 bytes simplydeleting all the spacing that makes the knightfigure,
cutting down the evaluation function wouldmake it smaller but that
deteriorates the computergameplay.By the way, if someone doesn't play
chess, here isa simple modification to make the computer playversus
itself, change 1<L&e to 1Regards,Óscar Toledo G. http://www.biyubi.com/
Nov 22 '06
63 15145
In article <11**********************@j44g2000cwa.googlegroups .com>,
ais523 <ai****@bham.ac.ukwrote:
>int main(void){main();}
>This is likely to break an implementation limit on many implementations, but I can imagine an implementation that recognizes the tail-recursion and goes into an infinite loop here
gcc appears to be such an implementation, when -O is used.
-- Richard
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
"William Hughes" <wp*******@hotmail.comwrote:
Guy Macon wrote:
dc*****@connx.com wrote:
>Another even shorter alternative is:
>
>int main(void) (while(1);return 0;}
>
>This program always loses the game on time.
You, sir, are brilliant! You program does indeed play
perfectly legal chess according to both FIDE and USCF
rules, runs on a wide variety of hardware, and is self
documenting as well.
The same program ported to FORTH runs much faster though... :)
On a Cray it executes in 15 seconds.
Then it's not a valid chess program on a Cray. This may be one of the
few examples of a purpose for which a Cray is less powerful than a
Sinclair ZX-81.
Richard
In article <ln************@nuthaus.mib.org>,
Keith Thompson <ks***@mib.orgwrote:
>int main(void){for(;;);}
Pah. These wimpy, verbose languages. In Algol, the "same"
program is only 21% of the size, and for good measure is palindromic,
almost symmetric, and almost a word:
DO~OD
><OT>Running this program on a multi-user system is likely to anger your fellow users.</OT>
Surely, only if it's a *bad* multi-user system? Or does the
idle loop equally annoy the users?
--
Andy Walker, School of MathSci., Univ. of Nott'm, UK. an*@maths.nott.ac.uk
In article <el**********@oyez.ccc.nottingham.ac.uk>,
Dr A. N. Walker <an*@maths.nott.ac.ukwrote:
>><OT>Running this program on a multi-user system is likely to anger your fellow users.</OT>
> Surely, only if it's a *bad* multi-user system? Or does the idle loop equally annoy the users?
[Still off-topic]
Unfortunately, there seem to be some bad multi-user systems around
these days. Running a single CPU-intensive process on our Linux
systems drastically slows down interactive response and network file
access. Perhaps it's related to Linux's Minix heritage...
-- Richard
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
ais523 <ai****@bham.ac.ukwrote:
You can save one more character by using a recursive call to main:
int main(void){main();}
This is likely to break an implementation limit on many
implementations
So it still fails to output a legal move within the time limit so
still loses on time. Mission accomplished, either way.
Dave.
--
David Richerby Accelerated Swiss Painting (TM): it's www.chiark.greenend.org.uk/~davidr/ like a Renaissance masterpiece but
it's made in Switzerland and twice
as fast!
Keith Thompson <ks***@mib.orgwrote:
<OT>Running this program on a multi-user system is likely to anger
your fellow users.
#include <sys/select.h>
int main () { select (1,0,0,0,0); }
Is much friendlier and only a little longer.</OT>
Dave.
--
David Richerby Aquatic Cyber-Laser (TM): it's like www.chiark.greenend.org.uk/~davidr/ an intense beam of light that exists
only in your computer but it lives in
the sea!
David Richerby <da****@chiark.greenend.org.ukwrites:
Keith Thompson <ks***@mib.orgwrote:
><OT>Running this program on a multi-user system is likely to anger your fellow users.
#include <sys/select.h>
int main () { select (1,0,0,0,0); }
Is much friendlier and only a little longer.
But it's not portable; the <sys/select.hheader and the select()
function are not part of standard C.
</OT>
--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
David Richerby wrote:
ais523 <ai****@bham.ac.ukwrote:
You can save one more character by using a recursive call to main:
int main(void){main();}
This is likely to break an implementation limit on many
implementations
So it still fails to output a legal move within the time limit so
still loses on time. Mission accomplished, either way.
Yes, but if you allow anything that "fails to output a legal
move within the time limit" , isn't the empty program
a solution?
- William Hughes
I remember that somebody wrote a demonstration chess program about 25 years
ago on the Sinclair ZX81, which only had a 1K memory. The program could
take the first three moves.
<dc*****@connx.comwrote in message
news:11**********************@h54g2000cwb.googlegr oups.com... bi****@gmail.com wrote:
Hi, a year ago I won the 2005 Best Game categoryof the International
Obfuscated C Code Contestwith a chess program. http://www.ioccc.org/whowon2005.html http://www.mailcom.com/ioccc/toledo/hint.htmBut this post is because I
have discovered (asurprise for me) that it is also the worldsmallest
chess program written in C language.It has a size of 3004 bytes, or
2261 bytes simplydeleting all the spacing that makes the knightfigure,
cutting down the evaluation function wouldmake it smaller but that
deteriorates the computergameplay.By the way, if someone doesn't play
chess, here isa simple modification to make the computer playversus
itself, change 1<L&e to 1Regards,Óscar Toledo G.http://www.biyubi.com/
It's not the smallest C chess program in the world. http://home.hccnet.nl/h.g.muller/max1.html
On 2006-12-12 17:52:21 +0100, h.********@hccnet.nl said:
>If you fail to see the full correspondence between these two situations, then I am at a loss as to how to make it clear.
There is nothing to make clear. We just don't agree on the definition
of Chess.
In my view the rules of Chess are a subset of the FIDE rules. There are
other FIDE rules that prescribe how participants in events organized by
FIDE should behave. These FIDE rules have nothing to do with Chess. The
Dutch Bridge Society has rules for when Bridge players can smoke during
a Bridge game. That dosn't mean that smoking a cigarete is playing
Bridge.
FIDE rules about offering draws, resigning, and other player
interactions that can determine the entry that goes in the score table
of a tournament by negociation without playing, have nothing to do with
Chess. FIDE rules allow you to participate in a FIDE tournament without
playing Chess.
Resigning is *not* a Chess move, it is merely exercising your right to
stop playing Chess. At any turn someone playing a Chess game has the
choice to play (a move) or to resign or forfeit on time (= not play).
Not playing does not violate FIDE rules. But that does not make not
playing playing Chess.
Je hebt gelijk. You are right on this, I second that.
Nice to see Harm-Geert active here too :)
Vincent
p.s. smallest chessprogram on planet in C:
#include <stdio.h>
main() {
printf("i resign\n");
return 0;
}
"Hans" <ma*@mac.macwrote in message
news:45********************@news.astraweb.com...
On 2006-12-12 17:52:21 +0100, h.********@hccnet.nl said:
>>If you fail to see the full correspondence between these two situations, then I am at a loss as to how to make it clear.
There is nothing to make clear. We just don't agree on the definition of Chess.
In my view the rules of Chess are a subset of the FIDE rules. There are other FIDE rules that prescribe how participants in events organized by FIDE should behave. These FIDE rules have nothing to do with Chess. The Dutch Bridge Society has rules for when Bridge players can smoke during a Bridge game. That dosn't mean that smoking a cigarete is playing Bridge.
FIDE rules about offering draws, resigning, and other player interactions that can determine the entry that goes in the score table of a tournament by negociation without playing, have nothing to do with Chess. FIDE rules allow you to participate in a FIDE tournament without playing Chess.
Resigning is *not* a Chess move, it is merely exercising your right to stop playing Chess. At any turn someone playing a Chess game has the choice to play (a move) or to resign or forfeit on time (= not play). Not playing does not violate FIDE rules. But that does not make not playing playing Chess.
Je hebt gelijk. You are right on this, I second that.
In comp.lang.c Vincent Diepeveen <di**@xs4all.nlwrote:
Nice to see Harm-Geert active here too :)
Currently "Here" includes comp.lang.c, and IMHO the discussion has
become sufficiently un-C-like that it would be best to remove
comp.lang.c from the followup list. Thanks. (f'ups set)
--
C. Benson Manica | I *should* know what I'm talking about - if I
cbmanica(at)gmail.com | don't, I need to know. Flames welcome. h.********@hccnet.nl said:
Resigning is *not* a Chess move, it is merely exercising your right to
stop playing Chess. At any turn someone playing a Chess game has the
choice to play (a move) or to resign or forfeit on time (= not play).
Not playing does not violate FIDE rules. But that does not make not
playing playing Chess.
So the worlds smallest/simplest chess program would make a move,
wait until the other side moves, *then* resign.
Guy Macon <http://www.guymacon.com/wrote: h.********@hccnet.nl said:
Resigning is *not* a Chess move, it is merely exercising your right to
stop playing Chess. At any turn someone playing a Chess game has the
choice to play (a move) or to resign or forfeit on time (= not play).
Not playing does not violate FIDE rules. But that does not make not
playing playing Chess.
So the worlds smallest/simplest chess program would make a move,
wait until the other side moves, *then* resign.
Just as the world's smallest OS would give you a file, trash it, and
then crash. So why is MS Windows so bleedin' large?
Richard This thread has been closed and replies have been disabled. Please start a new discussion. |