Main
Date: 22 Nov 2006 12:23:58
From:
Subject: World smallest chess program
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,=D3scar Toledo G.http://www.biyubi.com/





 
Date: 15 Dec 2006 13:12:41
From: William Hughes
Subject: Re: World smallest chess program

David Richerby wrote:
> ais523 <[email protected]> wrote:
> > 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



 
Date: 13 Dec 2006 04:52:33
From: William Hughes
Subject: Re: World smallest chess program

Guy Macon wrote:
> [email protected] 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.

- William Hughes



  
Date: 13 Dec 2006 14:08:36
From: Richard Bos
Subject: Re: World smallest chess program
"William Hughes" <[email protected] > wrote:

> Guy Macon wrote:
> > [email protected] 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


 
Date: 13 Dec 2006 12:49:26
From: Guy Macon
Subject: Re: World smallest chess program



[email protected] 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... :)







 
Date: 13 Dec 2006 04:07:11
From: ais523
Subject: Re: World smallest chess program
Keith Thompson wrote:

> And you can save a single character by using "for" rather than "while":
>
> int main(void){for(;;);}

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, but I can imagine an implementation that recognizes
the tail-recursion and goes into an infinite loop here (which is the
behaviour the Standard would suggest).
--
ais523



  
Date: 15 Dec 2006 13:11:16
From: David Richerby
Subject: Re: World smallest chess program
ais523 <[email protected] > wrote:
> 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!


  
Date: 13 Dec 2006 12:57:00
From: Richard Tobin
Subject: Re: World smallest chess program
In article <[email protected] >,
ais523 <[email protected] > wrote:

>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.


 
Date: 12 Dec 2006 17:41:50
From:
Subject: Re: World smallest chess program
CBFalconer wrote:
[snip]
> In seriousness, is there an available system for playing postal
> chess, which avoids the temptation of letting the program analyze?

Sure. Those that do not contain analyzing programs like:
http://deepfrozen.tripod.com/index.html
http://www.ectool.nu/
http://jhess.sourceforge.net/
http://astrodogpress.com/chess/
There are some others.



 
Date: 12 Dec 2006 11:25:41
From: CBFalconer
Subject: Re: World smallest chess program
CBFalconer wrote:
> Guy Macon wrote:
>> [email protected] wrote:
>>
>>> 10.2
>>> The game is won by the player whose opponent declares he resigns.
>>> This immediately ends the game.
>>> ..."+
>>>
>>>> From article 10.2, it is very clear that:
>>> #include <stdio.h>
>>> int main(void){puts("I resign");return 0}
>>> is a legal chess program. It also works fine for thematic
>>> tournaments.
>>
>> Legal, but far from small. stdio.h is *huge*.
>
> But puts is not. The remainder is a linking problem, and OT. :-)

In fact, to elaborate, the following is a satisfactory puts:

int puts(char *s) {
int err;

while (*s && (EOF != (err = putchar(*s++)))) continue;
if (err > 0) err = putchar('\n');
return err;
}

For many non-hosted systems, it suffices to code putchar(), which
will usually reduce to a half-dozen lines of assembly at worst.

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net >




 
Date: 12 Dec 2006 08:52:21
From:
Subject: Re: World smallest chess program
> 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.



  
Date: 12 Feb 2007 23:51:29
From: Hans
Subject: Re: World smallest chess program
On 2006-12-12 17:52:21 +0100, [email protected] 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.



   
Date: 14 Feb 2007 16:39:08
From: Guy Macon
Subject: Re: World smallest chess program



[email protected] 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.



    
Date: 15 Feb 2007 08:36:55
From: Richard Bos
Subject: Re: World smallest chess program
Guy Macon <http://www.guymacon.com/ > wrote:

> [email protected] 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


   
Date: 13 Feb 2007 17:42:59
From: Vincent Diepeveen
Subject: Re: World smallest chess program
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" <[email protected] > wrote in message
news:[email protected]...
> On 2006-12-12 17:52:21 +0100, [email protected] 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.
>




    
Date: 13 Feb 2007 16:53:01
From: Christopher Benson-Manica
Subject: Re: World smallest chess program
In comp.lang.c Vincent Diepeveen <[email protected] > wrote:

> 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


 
Date: 12 Dec 2006 06:28:35
From:
Subject: Re: World smallest chess program

David Richerby wrote:
> Richard Bos <[email protected]> wrote:
> > [email protected] wrote:
> >> David Richerby wrote:
> >>> IIRC, the ZX-81 chess program didn't allow en passant and/or
> >>> castling and/or underpromotion, so can't really be called `legal
> >>> chess'.
> >>
> >> Rybka, the strongest chess engine in the world, ignores some
> >> underpromotions (at one point it ignored all of them).
> >> Is it therefore not a chess program?
> >
> > If it allows you to under-promote, but does not choose to do so
> > itself, that's legal.
>
> Exactly. (Sorry for the `me too' but the question was kind of
> directed at me.)

How is it differnt than a program that resigns (plays fully under the
FIDE rules of chess)?
It also is simply not exercising every possible rule of the game. In
both cases the programs are simply choosing not to perform some of the
alternatives that are available to them.

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.

Another even shorter alternative is:

int main(void) (while(1);return 0;}

This program always loses the game on time.



  
Date: 12 Dec 2006 10:14:10
From: james of tucson
Subject: Re: World smallest chess program
[email protected] wrote:

> How is it differnt than a program that resigns (plays fully under the
> FIDE rules of chess)?
> It also is simply not exercising every possible rule of the game.

The difference is, a reasonable person will call you an idiot for making
that program, whereas a program that makes some attempt at actually
playing, might garner some respect.

If you honestly do not see the difference between, say, a one-statement
program that "just resigns", versus say, a one-liner that actually
*plays chess*, 100% completely or otherwise, you have a perception
problem, or you are merely being a clown.


   
Date: 12 Dec 2006 16:33:38
From: CBFalconer
Subject: Re: World smallest chess program
james of tucson wrote:
> [email protected] wrote:
>
>> How is it differnt than a program that resigns (plays fully under
>> the FIDE rules of chess)?
>> It also is simply not exercising every possible rule of the game.
>
> The difference is, a reasonable person will call you an idiot for
> making that program, whereas a program that makes some attempt at
> actually playing, might garner some respect.
>
> If you honestly do not see the difference between, say, a
> one-statement program that "just resigns", versus say, a one-liner
> that actually *plays chess*, 100% completely or otherwise, you have
> a perception problem, or you are merely being a clown.

Allright. Using the principal of successive refinement:

#include <stdio.h >

int turn;

int main(void)
{
do {
if (!turn++) puts("1: P-K4");
else {
puts("I resign");
return 0;
}
} while (1);
} /* main, fully tested */

Note that it works when playing either white or black. :-) The
next refinement is to get the players move, which will upset the
above universality. Algebraic notation will also upset that.

Ignore any compiler warnings about failure to return a value. The
compiler is confused.

In seriousness, is there an available system for playing postal
chess, which avoids the temptation of letting the program analyze?

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net >




    
Date: 13 Dec 2006 07:08:55
From: Richard Heathfield
Subject: Re: World smallest chess program
CBFalconer said:

<snip >

> In seriousness, is there an available system for playing postal
> chess, which avoids the temptation of letting the program analyze?

http://www.auspost.com.au
http://www.canadapost.ca
http://www.indiapost.gov.in
http://www.post.japanpost.jp/english/
http://www.newzealandmail.co.nz
http://www.royalmail.com
http://www.usps.com

are the Web sites of just some of the several specialist agencies dedicated
to providing a postal chess service (and other, somewhat related,
services). Alas, they won't normally provide you with an opponent, paper,
pencil, envelopes, pieces, or chess-board. But once you have solved those
problems, they can generally take up the strain from there.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.


  
Date: 12 Dec 2006 15:50:36
From: David Richerby
Subject: Re: World smallest chess program
<[email protected] > wrote:
> David Richerby wrote:
>> Richard Bos <[email protected]> wrote:
>>> [email protected] wrote:
>>>> David Richerby wrote:
>>>>> IIRC, the ZX-81 chess program didn't allow en passant and/or
>>>>> castling and/or underpromotion, so can't really be called `legal
>>>>> chess'.
>>>>
>>>> Rybka, the strongest chess engine in the world, ignores some
>>>> underpromotions (at one point it ignored all of them).
>>>> Is it therefore not a chess program?
>>>
>>> If it allows you to under-promote, but does not choose to do so
>>> itself, that's legal.
>>
>> Exactly. (Sorry for the `me too' but the question was kind of
>> directed at me.)
>
> How is it differnt than a program that resigns (plays fully under the
> FIDE rules of chess)?
> It also is simply not exercising every possible rule of the game. In
> both cases the programs are simply choosing not to perform some of the
> alternatives that are available to them.

As far as I can see, we're in complete agreement! My objection to the
ZX-81 program was that not allow its opponent to castle, capture en
passant or underpromote. If a program wishes to avoid making certain
types of moves itself or to resign without even considering the
position, that's perfectly within its prerogative.


> 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.
>
> Another even shorter alternative is:
>
> int main(void) (while(1);return 0;}
>
> This program always loses the game on time.

Indeed -- as I posted myself earlier. (This is not a criticism of you
for posting the same program; just an observation that I was already
aware of this idea.)


Dave.

--
David Richerby Pickled Priest (TM): it's like a
www.chiark.greenend.org.uk/~davidr/ man of the cloth but it's preserved
in vinegar!


   
Date: 13 Dec 2006 12:54:24
From: Guy Macon
Subject: Re: World smallest chess program



David Richerby wrote:
>
><[email protected]> wrote:

>> [...] a program that resigns (plays fully under the FIDE rules
>> of chess) [...] is simply not exercising every possible rule
>> of the game. In both cases the programs are simply choosing
>> not to perform some of the alternatives that are available t
>> to them.
>
>As far as I can see, we're in complete agreement! My objection to the
>ZX-81 program was that not allow its opponent to castle, capture en
>passant or underpromote. If a program wishes to avoid making certain
>types of moves itself or to resign without even considering the
>position, that's perfectly within its prerogative.

Exactly so. The ZX-81 was palying something a lot like chess,
but it wasn't playing chess.

Guy Macon
<http://www.guymacon.com/ >



 
Date: 12 Dec 2006 05:04:10
From:
Subject: Re: World smallest chess program

max schreef:

> No idea how small micro-Max is, but back in the 1980s there was a chess
> program that fitted within the 1K ZX-81 memory - Z80 machine code, but
> making use of the 16K ZX-81 ROM, for IO. Apparently it played legal but bad
> chess.
>

One should distingush the sizes of the source code, the executable and
the memory size used including data. The 1KB ZX81 program was a real
achievement, since the 1KB had to hold both the program code and the
data. I am not sure if it was written (entirely) in assembler, though,
because I seem to recall that the ZX-81 had a BASIC interpreter in ROM,
so the program could also have been encoded BASIC instructions (which
could do more per byte than Z80 machine instructions).

In those days I had written a 2KB chess program (code + data) for the
6800 micro-processor, called Usurpator I. The micro-Max project was
actually inspired by the question if I could rival such code density in
a high-level language. The source of such assembly programs was much
larger, of course, since a single-byte assembly instruction typically
took 5 characters to write down. On the other hand, micro-Max is very
memory-hungry for data: in just a few characters you can declare an
array of hundreds of megabytes (int A[1<<26];), and this is exactly
what micro-Max does. So in that sense the comparison is not fair.

Dan and I simply disagree about whether resigning should count as
playing Chess. In my opinion playing Chess is what you do *before* you
resign. That the FIDE rules stipulate that you are allowed to stop
playing Chess any time you like during a game (by resigning) does not
convince me that the stopping itself is part of the game. I would
reserve the term Chess program for a program that can play a game of
Chess to the very end without resigning.



  
Date: 12 Dec 2006 16:08:18
From: james of tucson
Subject: Re: World smallest chess program
[email protected] wrote:

> One should distingush the sizes of the source code, the executable and
> the memory size used including data. The 1KB ZX81 program was a real
> achievement, since the 1KB had to hold both the program code and the
> data. I am not sure if it was written (entirely) in assembler, though,
> because I seem to recall that the ZX-81 had a BASIC interpreter in ROM,
> so the program could also have been encoded BASIC instructions (which
> could do more per byte than Z80 machine instructions).

In those days, it was common practice to code in assembler while making
maximum use of routines that could be found in ROM -- you could use it
for constants, use routines as they were meant to be used, and very
clever people figured out ways to use ROM in really bizarre ways, with
arbitrary entry points, setting registers a certain way, etc.
I knew some of this stuff for Model-I TRS-80. I realized it was an
insane practice then, but it was how you pushed the envelope and squoze
every last byte out of the machine.


  
Date: 13 Dec 2006 03:18:36
From: Chris Baird
Subject: Re: World smallest chess program
>> No idea how small micro-Max is, but back in the 1980s there was a
>> chess program that fitted within the 1K ZX-81 memory - Z80 machine
>> code, but making use of the 16K ZX-81 ROM, for IO.

Not to omit Microchess for the 6502/KIM-1 system, that squeezed itself
into 1kB:

http://www.benlo.com/microchess/microchess.html

--
Chris


  
Date: 12 Dec 2006 15:00:52
From: David Richerby
Subject: Re: World smallest chess program
<[email protected] > wrote:
> Dan and I simply disagree about whether resigning should count as
> playing Chess. In my opinion playing Chess is what you do *before*
> you resign. That the FIDE rules stipulate that you are allowed to
> stop playing Chess any time you like during a game (by resigning)
> does not convince me that the stopping itself is part of the game. I
> would reserve the term Chess program for a program that can play a
> game of Chess to the very end without resigning.

In that case,

int main() {while (1);}

is a chess program: it will lose every game on time. I think the best
way to proceed is to use the term `non-trivial chess program'.


Dave.

--
David Richerby Aluminium Bulb (TM): it's like a light
www.chiark.greenend.org.uk/~davidr/ bulb that's really light!


 
Date: 12 Dec 2006 07:02:07
From: CBFalconer
Subject: Re: World smallest chess program
Guy Macon wrote:
> [email protected] wrote:
>
>> 10.2
>> The game is won by the player whose opponent declares he resigns.
>> This immediately ends the game.
>> ..."+
>>
>>> From article 10.2, it is very clear that:
>> #include <stdio.h>
>> int main(void){puts("I resign");return 0}
>> is a legal chess program. It also works fine for thematic
>> tournaments.
>
> Legal, but far from small. stdio.h is *huge*.

But puts is not. The remainder is a linking problem, and OT. :-)

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net >




 
Date: 12 Dec 2006 02:49:43
From: jaapsch
Subject: Re: World smallest chess program
james of tucson wrote:
> max wrote:
> > No idea how small micro-Max is, but back in the 1980s there was a chess
> > program that fitted within the 1K ZX-81 memory - Z80 machine code, but
> > making use of the 16K ZX-81 ROM, for IO. Apparently it played legal but bad
> > chess.
>
> Was that a derivative of Sargon?

No it wasn't actually. The 1K zx81 chess program used no look ahead (or
rather just 1-ply). Iit just evaluated a score for each of its
available moves.

Since the screen contents also were stored in that 1k memory, this
program cleverly didn't have any code to draw the board. You had to
reload the program from tape to play another game. It also used that
screen memory directly for its board representation, i.e. it did not
have any other copy of the board contents in memory.

It was fun to completely disassemble it to see how it worked.

> There were versions of Sargon as early
> as 1978. Sargon is actually not that difficult to digest. I read the
> book in 1980, and actually considered implementing a version.

I still have that book, full of pencil annotations. I also wanted to
implement it, but as an 11-year-old that was a daunting task that I
never got around to. It taught me a lot though.


--
Jaap's Puzzle Page:
http://www.geocities.com/jaapsch/puzzles/



 
Date: 12 Dec 2006 08:37:47
From: Guy Macon
Subject: Re: World smallest chess program



[email protected] wrote:


>10.2
>The game is won by the player whose opponent declares he resigns. This
>immediately ends the game.
>..."
>
>>From article 10.2, it is very clear that:
>#include <stdio.h>
>int main(void){puts("I resign");return 0}
>is a legal chess program. It also works fine for thematic tournaments.

Legal, but far from small. stdio.h is *huge*.






  
Date: 12 Dec 2006 18:20:41
From: Barry Schwarz
Subject: Re: World smallest chess program
On Tue, 12 Dec 2006 08:37:47 +0000, Guy Macon
<http://www.guymacon.com/ > wrote:

>
>
>
>[email protected] wrote:
>
>
>>10.2
>>The game is won by the player whose opponent declares he resigns. This
>>immediately ends the game.
>>..."
>>
>>>From article 10.2, it is very clear that:
>>#include <stdio.h>
>>int main(void){puts("I resign");return 0}
>>is a legal chess program. It also works fine for thematic tournaments.
>
>Legal, but far from small. stdio.h is *huge*.

Perhaps but it's a header file and does not appear in your executable
program.


Remove del for email


  
Date: 12 Dec 2006 09:04:32
From: Richard Heathfield
Subject: Re: World smallest chess program
Guy Macon <http://www.guymacon.com/ > said:

>
>
>
> [email protected] wrote:
>
>
>>10.2
>>The game is won by the player whose opponent declares he resigns. This
>>immediately ends the game.
>>..."
>>
>>>From article 10.2, it is very clear that:
>>#include <stdio.h>
>>int main(void){puts("I resign");return 0}
>>is a legal chess program. It also works fine for thematic tournaments.
>
> Legal, but far from small. stdio.h is *huge*.

puts(const char *);main(){puts("I resign");return 0;}

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.


   
Date: 12 Dec 2006 09:11:09
From: Guy Macon
Subject: Re: World smallest chess program



Richard Heathfield wrote:
>
>Guy Macon <http://www.guymacon.com/> said:
>
>> [email protected] wrote:
>>
>>>10.2
>>>The game is won by the player whose opponent declares he resigns. This
>>>immediately ends the game.
>>>..."
>>>
>>>>From article 10.2, it is very clear that:
>>>#include <stdio.h>
>>>int main(void){puts("I resign");return 0}
>>>is a legal chess program. It also works fine for thematic tournaments.
>>
>> Legal, but far from small. stdio.h is *huge*.
>
>puts(const char *);main(){puts("I resign");return 0;}

Now *that's* what I call a small chess-playing program! <grin >

And, as an added bonus, it wins against my computer as often
as I do...






 
Date: 11 Dec 2006 17:41:14
From:
Subject: Re: World smallest chess program

[email protected] wrote:
> David Richerby wrote:
> > max <[email protected]> wrote:
> > > No idea how small micro-Max is, but back in the 1980s there was a
> > > chess program that fitted within the 1K ZX-81 memory - Z80 machine
> > > code, but making use of the 16K ZX-81 ROM, for IO. Apparently it
> > > played legal but bad chess.
> >
> > IIRC, the ZX-81 chess program didn't allow en passant and/or castling
> > and/or underpromotion, so can't really be called `legal chess'.
> >
> >
> > Dave.
> >
> > --
> > David Richerby Mentholated Chair (TM): it's like a
> > www.chiark.greenend.org.uk/~davidr/ chair but it's invigorating!
>
> Rybka, the strongest chess engine in the world, ignores some
> underpromotions (at one point it ignored all of them).
> Is it therefore not a chess program?
>
> Similarly, the chess program Junior won the world championship without
> performing underpromotions -- even when an underpromotion is the best
> move.
> Is Junior therefore not a chess program?
>
> Both of these programs are sold commercially and even used by chess
> experts to analyze games.
>
> My two line chess program obeys the FIDE rules of chess and is
> therefore a complete and working chess program.
> It loses every game, but that is beside the point.
From:
http://www.chessvariants.com/fidelaws.html
We have this:
"Article 10: The Completed Game
10.1
The game is won by the player who has checkmated his opponent's king.
This immediately ends the game.
10.2
The game is won by the player whose opponent declares he resigns. This
immediately ends the game.
..."

>From article 10.2, it is very clear that:
#include <stdio.h >
int main(void){puts("I resign");return 0}
is a legal chess program. It also works fine for thematic tournaments.



 
Date: 11 Dec 2006 17:37:05
From:
Subject: Re: World smallest chess program

David Richerby wrote:
> max <[email protected]> wrote:
> > No idea how small micro-Max is, but back in the 1980s there was a
> > chess program that fitted within the 1K ZX-81 memory - Z80 machine
> > code, but making use of the 16K ZX-81 ROM, for IO. Apparently it
> > played legal but bad chess.
>
> IIRC, the ZX-81 chess program didn't allow en passant and/or castling
> and/or underpromotion, so can't really be called `legal chess'.
>
>
> Dave.
>
> --
> David Richerby Mentholated Chair (TM): it's like a
> www.chiark.greenend.org.uk/~davidr/ chair but it's invigorating!

Rybka, the strongest chess engine in the world, ignores some
underpromotions (at one point it ignored all of them).
Is it therefore not a chess program?

Similarly, the chess program Junior won the world championship without
performing underpromotions -- even when an underpromotion is the best
move.
Is Junior therefore not a chess program?

Both of these programs are sold commercially and even used by chess
experts to analyze games.

My two line chess program obeys the FIDE rules of chess and is
therefore a complete and working chess program.
It loses every game, but that is beside the point.



  
Date: 12 Dec 2006 10:31:15
From: Richard Bos
Subject: Re: World smallest chess program
[email protected] wrote:

> David Richerby wrote:
> > max <[email protected]> wrote:
> > > No idea how small micro-Max is, but back in the 1980s there was a
> > > chess program that fitted within the 1K ZX-81 memory - Z80 machine
> > > code, but making use of the 16K ZX-81 ROM, for IO. Apparently it
> > > played legal but bad chess.
> >
> > IIRC, the ZX-81 chess program didn't allow en passant and/or castling
> > and/or underpromotion, so can't really be called `legal chess'.
>
> Rybka, the strongest chess engine in the world, ignores some
> underpromotions (at one point it ignored all of them).
> Is it therefore not a chess program?

If it allows you to under-promote, but does not choose to do so itself,
that's legal.

Richard


   
Date: 12 Dec 2006 12:01:37
From: David Richerby
Subject: Re: World smallest chess program
Richard Bos <[email protected] > wrote:
> [email protected] wrote:
>> David Richerby wrote:
>>> IIRC, the ZX-81 chess program didn't allow en passant and/or
>>> castling and/or underpromotion, so can't really be called `legal
>>> chess'.
>>
>> Rybka, the strongest chess engine in the world, ignores some
>> underpromotions (at one point it ignored all of them).
>> Is it therefore not a chess program?
>
> If it allows you to under-promote, but does not choose to do so
> itself, that's legal.

Exactly. (Sorry for the `me too' but the question was kind of
directed at me.)


Dave.

--
David Richerby Natural Newspaper (TM): it's like a
www.chiark.greenend.org.uk/~davidr/ daily broadsheet but it's completely
natural!


    
Date: 15 Dec 2006 21:01:56
From: Keith Thompson
Subject: Re: World smallest chess program
David Richerby <[email protected] > writes:
> Keith Thompson <[email protected]> wrote:
>> <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.h > header and the select()
function are not part of standard C.

> </OT>

--
Keith Thompson (The_Other_Keith) [email protected] <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.


  
Date: 11 Dec 2006 19:25:15
From: james of tucson
Subject: Re: World smallest chess program
[email protected] wrote:

> Rybka, the strongest chess engine in the world, ignores some
> underpromotions (at one point it ignored all of them).
> Is it therefore not a chess program?

I stalemated a tournament game that I would have won, had I not promoted
to a queen. You just reminded me of that frustrating day. Thanks.


 
Date: 11 Dec 2006 07:11:35
From:
Subject: Re: World smallest chess program
> P.S.
> This is the world's smallest chess program. It plays legal chess, but
> it will not fare very well in contests:
> #include <stdio.h>
> int main(void)
> {puts("I resign.");return 0;}

Let me clarify something here.

This discussion is obviously only meaningfull is there is an
unambiguous definition of the concept 'Chess Program'. Like always,
when exploring a boundary, this is not completely obvious what this
should be.

I always have found the following definition to work satisfactory:

A chess program is a program that, according to unambiguous
input/output rules defined by the programmer, is able to score
significantly (in the statistical sense) better than 50% against an
opponent that plays random legal moves.

This would exclude quirks like the one above. (Which I consider a good
thing.) Also note that the random move generator does not yet qualify
as a chess program. (In topological terms, it is on the edge, but not
in the set itself.) To be a chess program you have to do something
more, but it can be an infinitesimal amount.

According to my definition, it is not a requirement that the program
plays legal moves in every situation. Requiring so, would be tantamount
to requiring that the program contains no bugs. Since in general this
cannot be proven for a language as powerful as C, requiring such a
thing would render the definition useless. Giving off an illegal move
should simply be counted as a resignation. If a program that has a
habit of doing this does not do it so often that it no longer clearly
beats the random mover, it still is a chess program.

According to this definition, both micro-Max and Toledo are chess
programs by a large gin. Micro-Max is smaller. And stronger :D,
despite the fact that (unlike what was stated above) it does neither
do, nor accept minor promotions. If the opponent does a minor promotion
that makes a difference (i.e. the piece is not immediately captured)
the response of micro-Max should be considered a resignation. This has
negligible impact on its performance.

I don't know if micro-Max is actually the world's smallest chess
program, but I am not aware of any program that is smaller.



  
Date: 12 Dec 2006 22:38:33
From: Keith Thompson
Subject: Re: World smallest chess program
David Richerby <[email protected] > writes:
> <[email protected]> wrote:
>> Dan and I simply disagree about whether resigning should count as
>> playing Chess. In my opinion playing Chess is what you do *before*
>> you resign. That the FIDE rules stipulate that you are allowed to
>> stop playing Chess any time you like during a game (by resigning)
>> does not convince me that the stopping itself is part of the game. I
>> would reserve the term Chess program for a program that can play a
>> game of Chess to the very end without resigning.
>
> In that case,
>
> int main() {while (1);}
>
> is a chess program: it will lose every game on time. I think the best
> way to proceed is to use the term `non-trivial chess program'.

I also suggest considering carefully whether further followups should
go to comp.lang.c, rec.games.chess.computer, or both. If you're not
discussing the C programming language, please consider limiting your
followup to rec.games.chess.computer.

--
Keith Thompson (The_Other_Keith) [email protected] <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.


  
Date: 11 Dec 2006 21:04:07
From: max
Subject: Re: World smallest chess program
No idea how small micro-Max is, but back in the 1980s there was a chess
program that fitted within the 1K ZX-81 memory - Z80 machine code, but
making use of the 16K ZX-81 ROM, for IO. Apparently it played legal but bad
chess.

<[email protected] > wrote in message
news:[email protected]...
> > P.S.
> > This is the world's smallest chess program. It plays legal chess, but
> > it will not fare very well in contests:
> > #include <stdio.h>
> > int main(void)
> > {puts("I resign.");return 0;}
>
> Let me clarify something here.
>
> This discussion is obviously only meaningfull is there is an
> unambiguous definition of the concept 'Chess Program'. Like always,
> when exploring a boundary, this is not completely obvious what this
> should be.
>
> I always have found the following definition to work satisfactory:
>
> A chess program is a program that, according to unambiguous
> input/output rules defined by the programmer, is able to score
> significantly (in the statistical sense) better than 50% against an
> opponent that plays random legal moves.
>
> This would exclude quirks like the one above. (Which I consider a good
> thing.) Also note that the random move generator does not yet qualify
> as a chess program. (In topological terms, it is on the edge, but not
> in the set itself.) To be a chess program you have to do something
> more, but it can be an infinitesimal amount.
>
> According to my definition, it is not a requirement that the program
> plays legal moves in every situation. Requiring so, would be tantamount
> to requiring that the program contains no bugs. Since in general this
> cannot be proven for a language as powerful as C, requiring such a
> thing would render the definition useless. Giving off an illegal move
> should simply be counted as a resignation. If a program that has a
> habit of doing this does not do it so often that it no longer clearly
> beats the random mover, it still is a chess program.
>
> According to this definition, both micro-Max and Toledo are chess
> programs by a large gin. Micro-Max is smaller. And stronger :D,
> despite the fact that (unlike what was stated above) it does neither
> do, nor accept minor promotions. If the opponent does a minor promotion
> that makes a difference (i.e. the piece is not immediately captured)
> the response of micro-Max should be considered a resignation. This has
> negligible impact on its performance.
>
> I don't know if micro-Max is actually the world's smallest chess
> program, but I am not aware of any program that is smaller.
>




   
Date: 11 Dec 2006 17:33:37
From: james of tucson
Subject: Re: World smallest chess program
max wrote:
> No idea how small micro-Max is, but back in the 1980s there was a chess
> program that fitted within the 1K ZX-81 memory - Z80 machine code, but
> making use of the 16K ZX-81 ROM, for IO. Apparently it played legal but bad
> chess.

Was that a derivative of Sargon? There were versions of Sargon as early
as 1978. Sargon is actually not that difficult to digest. I read the
book in 1980, and actually considered implementing a version.
Everything you needed to know about Z-80 programming could have been
learned from this program. Add to that perhaps the basic approach to
CP/M syscalls and you were golden, in those days.

http://madscientistroom.org/chm/Sargon.html


   
Date: 11 Dec 2006 22:50:59
From: David Richerby
Subject: Re: World smallest chess program
max <[email protected] > wrote:
> No idea how small micro-Max is, but back in the 1980s there was a
> chess program that fitted within the 1K ZX-81 memory - Z80 machine
> code, but making use of the 16K ZX-81 ROM, for IO. Apparently it
> played legal but bad chess.

IIRC, the ZX-81 chess program didn't allow en passant and/or castling
and/or underpromotion, so can't really be called `legal chess'.


Dave.

--
David Richerby Mentholated Chair (TM): it's like a
www.chiark.greenend.org.uk/~davidr/ chair but it's invigorating!


    
Date: 12 Dec 2006 22:34:24
From: Keith Thompson
Subject: Re: World smallest chess program
[email protected] writes:
[...]
> Another even shorter alternative is:
>
> int main(void) (while(1);return 0;}
>
> This program always loses the game on time.

The "return 0;" is not necessary. In C99, reaching the '}' that
terminates the main function is equivalent to "return 0;". In C90, it
merely causes an unspecified status to be returned to the environment,
but that doesn't matter since it can't ever be executed anyway.

And you can save a single character by using "for" rather than "while":

int main(void){for(;;);}

In C90, you can drop the "int "; it's required in C99.

<OT >Running this program on a multi-user system is likely to anger
your fellow users.</OT >

--
Keith Thompson (The_Other_Keith) [email protected] <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.


     
Date: 15 Dec 2006 13:18:48
From: David Richerby
Subject: Re: World smallest chess program
Keith Thompson <[email protected] > wrote:
> <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!


     
Date: 13 Dec 2006 17:13:37
From: Dr A. N. Walker
Subject: Re: World smallest chess program
In article <[email protected] >,
Keith Thompson <[email protected] > wrote:
>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.
[email protected]


      
Date: 14 Dec 2006 00:23:41
From: Richard Tobin
Subject: Re: World smallest chess program
In article <[email protected] >,
Dr A. N. Walker <[email protected] > wrote:

>><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.


    
Date: 12 Dec 2006 11:59:45
From: David Richerby
Subject: Re: World smallest chess program
David Richerby <[email protected] > wrote:
> max <[email protected]> wrote:
>> No idea how small micro-Max is, but back in the 1980s there was a
>> chess program that fitted within the 1K ZX-81 memory - Z80 machine
>> code, but making use of the 16K ZX-81 ROM, for IO. Apparently it
>> played legal but bad chess.
>
> IIRC, the ZX-81 chess program didn't allow en passant and/or
> castling and/or underpromotion, so can't really be called `legal
> chess'.

I see now that there was more than one commercially available chess
program for the ZX81. At least one of these implemented all legal
moves but it is implied in

http://www.sincuser.f9.co.uk/016/mindgms.htm

that this required 16KB RAM. I infer this because the article then
goes on to say,

``Artic also produces a technically-excellent game which fits into
the 1K ZX-81. It may not play brilliantly but it is fascinating to
watch the computer scan the moves available to it graphically on
the screen. The computer makes moves very quickly, although it
will not allow the usual en passant and castling which are
available on the bigger games. The game loads very quickly and at
GBP2.95 it is worth the money.''

I suspect that this is the program I was thinking of.


Dave.

--
David Richerby Old-Fashioned Mexi-Pants (TM):
www.chiark.greenend.org.uk/~davidr/ it's like a well-tailored pair of
trousers that comes from Mexico but
it's perfect for your grandparents!


    
Date: 11 Dec 2006 17:56:39
From: james of tucson
Subject: Re: World smallest chess program
David Richerby wrote:
> max <[email protected]> wrote:
>> No idea how small micro-Max is, but back in the 1980s there was a
>> chess program that fitted within the 1K ZX-81 memory - Z80 machine
>> code, but making use of the 16K ZX-81 ROM, for IO. Apparently it
>> played legal but bad chess.
>
> IIRC, the ZX-81 chess program didn't allow en passant and/or castling
> and/or underpromotion, so can't really be called `legal chess'.

The 1978 Sargon I that, I believe, the ZX-81 chess was based on,
supported E-P and castling. You could implement Sargon I in 8K RAM.
It was not *that* bad. You could beat it easily in the opening of
course, and alpha-beta pruning doesn't really work for endgames, but its
tactics are not all that bad. I believe that in 1980, a Sargon-I on a
Z-80 microcomputer had a rating in the 1600's. I suspect it was the
basis for some of the purpose-built chess computers of the day.

Sargon does a pretty good job of pruning loss-lines, provided they are
evaluated as losses early enough. It is a very good example of
Alpha-Beta pruning, and does what I would call a magnificent job of
pushing the limits of a small memory space for evaluating board
positions. I mean, GNUChess does essentially the same thing (I know PVS
is more than just an optimization of Alpha-Beta, but it's still
essentially the same approach to evaluation).

I've seen ster guys than myself be beaten time and time again by
GNUChess. Also, I suspect that there are problem setups you could feed
to Sargon that would allow its tactics to play quite strongly, even on a
16K machine.

I'm not seriously trying to compare Sargon I to a computer chess program
that can be configured with hundreds of megabytes of opening book,
complete solutions for 5-piece endgames, and that can exploit
multi-gigahertz processors and gigabytes of ram for tactical evaluation.
But I still say that Sargon and its variants might surprise you. Yeah,
you can beat it every time -- but if you refrain from confusing it in
the opening, you may find it quite surprisingly "strong" in midgame
tactics.

I'm no chess champion, by any means (I play in the 1400's), and I only
dabble in game programming, so don't contribute to the conversation by
tearing my analysis to shreds. I'd actually like to read on this topic
from people who have implement a-b on a board game, for instance.


 
Date: 25 Nov 2006 12:20:53
From:
Subject: Re: World smallest chess program
[email protected] wrote:
> William Hughes ha escrito:
>
> > Old Wolf wrote:
> > > [email protected] wrote:
> > > > [email protected] wrote:
> > > > > have discovered (asurprise for me) that it is also the worldsmall=
est
> > > > > chess program written in C language.It has a size of 3004 bytes, =
or
> > > > > 2261 bytes
> > > >
> > > > It's not the smallest C chess program in the world.
> > > > http://home.hccnet.nl/h.g.muller/max1.html
> > >
> > > That page says that its software doesn't even implement
> > > the rules of chess properly .. I don't think that counts
> >
> > However this version does.
> >
> > http://home.hccnet.nl/h.g.muller/max-src2.html
> >
> > and at 2000 bytes is still smaller.
> >
> > -William Hughes
>
> My program is still the world smallest chess
> program, as it does all legal chess moves (the
> other program cannot promote to knight, bishop
> or rook).
>
> As a bonus it includes messages for the current
> score, stalemate and checkmate and a good board
> display for the user's benefit.
>
> Is very possible to cut all those "extras" and
> leave a bare chess engine, getting it far below
> the actual size of 2044 IOCCC characters (characters
> minus spaces, and } { ; followed by space).
>
> But I leave that as an exercise for the readers. ;)
>
> About the random generator, is easy to add a
> *NIX only srand(getpid()); at the program start.
>
> Regards,
> =D3scar Toledo G.
> http://www.biyubi.com/

While I will admit that writing a working chess program is impressive
and your program is no exception, his program does recognize
underpromotion, it just does not play it. So the only consequence will
be suboptimal play on those rare occasions where underpromotion is
beneficial. BTW, his chess program will positively destroy yours in a
course of games.

P=2ES.
This is the world's smallest chess program. It plays legal chess, but
it will not fare very well in contests:
#include <stdio.h >
int main(void)
{puts("I resign.");return 0;}



  
Date: 25 Nov 2006 18:02:00
From: Kenneth Sloan
Subject: Re: World smallest chess program
[email protected] wrote:
> [email protected] wrote:
>> William Hughes ha escrito:
>>
>>> Old Wolf wrote:
>>>> [email protected] wrote:
>>>>> [email protected] wrote:
>>>>>> 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
>>>>> It's not the smallest C chess program in the world.
>>>>> http://home.hccnet.nl/h.g.muller/max1.html
>>>> That page says that its software doesn't even implement
>>>> the rules of chess properly .. I don't think that counts
>>> However this version does.
>>>
>>> http://home.hccnet.nl/h.g.muller/max-src2.html
>>>
>>> and at 2000 bytes is still smaller.
>>>
>>> -William Hughes
>> My program is still the world smallest chess
>> program, as it does all legal chess moves (the
>> other program cannot promote to knight, bishop
>> or rook).
>>
>> As a bonus it includes messages for the current
>> score, stalemate and checkmate and a good board
>> display for the user's benefit.
>>
>> Is very possible to cut all those "extras" and
>> leave a bare chess engine, getting it far below
>> the actual size of 2044 IOCCC characters (characters
>> minus spaces, and } { ; followed by space).
>>
>> But I leave that as an exercise for the readers. ;)
>>
>> About the random generator, is easy to add a
>> *NIX only srand(getpid()); at the program start.
>>
>> Regards,
>> �scar Toledo G.
>> http://www.biyubi.com/
>
> While I will admit that writing a working chess program is impressive
> and your program is no exception, his program does recognize
> underpromotion, it just does not play it. So the only consequence will
> be suboptimal play on those rare occasions where underpromotion is
> beneficial. BTW, his chess program will positively destroy yours in a
> course of games.
>
> P.S.
> This is the world's smallest chess program. It plays legal chess, but
> it will not fare very well in contests:
> #include <stdio.h>
> int main(void)
> {puts("I resign.");return 0;}
>
This program can be made MUCH shorter.

--
Kenneth Sloan [email protected]
Computer and Information Sciences +1-205-932-2213
University of Alabama at Birmingham FAX +1-205-934-5473
Birmingham, AL 35294-1170 http://www.cis.uab.edu/sloan/


 
Date: 22 Nov 2006 19:56:32
From:
Subject: Re: World smallest chess program


William Hughes ha escrito:

> Old Wolf wrote:
> > [email protected] wrote:
> > > [email protected] wrote:
> > > > 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
> > >
> > > It's not the smallest C chess program in the world.
> > > http://home.hccnet.nl/h.g.muller/max1.html
> >
> > That page says that its software doesn't even implement
> > the rules of chess properly .. I don't think that counts
>
> However this version does.
>
> http://home.hccnet.nl/h.g.muller/max-src2.html
>
> and at 2000 bytes is still smaller.
>
> -William Hughes

My program is still the world smallest chess
program, as it does all legal chess moves (the
other program cannot promote to knight, bishop
or rook).

As a bonus it includes messages for the current
score, stalemate and checkmate and a good board
display for the user's benefit.

Is very possible to cut all those "extras" and
leave a bare chess engine, getting it far below
the actual size of 2044 IOCCC characters (characters
minus spaces, and } { ; followed by space).

But I leave that as an exercise for the readers. ;)

About the random generator, is easy to add a
*NIX only srand(getpid()); at the program start.

Regards,
=D3scar Toledo G.
http://www.biyubi.com/



 
Date: 22 Nov 2006 19:31:34
From: William Hughes
Subject: Re: World smallest chess program

Old Wolf wrote:
> [email protected] wrote:
> > [email protected] wrote:
> > > 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
> >
> > It's not the smallest C chess program in the world.
> > http://home.hccnet.nl/h.g.muller/max1.html
>
> That page says that its software doesn't even implement
> the rules of chess properly .. I don't think that counts

However this version does.

http://home.hccnet.nl/h.g.muller/max-src2.html

and at 2000 bytes is still smaller.

-William Hughes



 
Date: 22 Nov 2006 19:29:19
From: Old Wolf
Subject: Re: World smallest chess program
[email protected] wrote:
> Hi, a year ago I won the 2005 Best Game categoryof the International
> Obfuscated C Code Contestwith a chess program.
>
> cutting down the evaluation function would make it smaller but that
> deteriorates the computer gameplay.

Well, in the 5-ply mode I won in 8 moves the first game, and it
allows repetition of the same game each time. You might like
to mix it up a bit by randomizing amonst the top few candidate
moves, if they all have similar evaluations.

The game was: 1. e4 Nc6; 2. d4 Nf6; 3. Bd3 d5; 4. e5 Nd7;
5. c3 f6; 6. Qh5+ g6; 7. Qxg6+ hg; 8. Bxg6#



  
Date: 23 Nov 2006 09:03:44
From: David Richerby
Subject: Re: World smallest chess program
Old Wolf <[email protected] > wrote:
> [email protected] wrote:
>> Hi, a year ago I won the 2005 Best Game categoryof the International
>> Obfuscated C Code Contestwith a chess program.
>>
>> cutting down the evaluation function would make it smaller but that
>> deteriorates the computer gameplay.
>
> Well, in the 5-ply mode I won in 8 moves the first game, and it
> allows repetition of the same game each time.

Something tells me that playing high quality chess wasn't one of the
project's design goals...


Dave.

--
David Richerby Sadistic Cheese Watch (TM): it's like
www.chiark.greenend.org.uk/~davidr/ a precision chronometer that's made
of cheese but it wants to hurt you!


 
Date: 22 Nov 2006 19:03:16
From: Old Wolf
Subject: Re: World smallest chess program
[email protected] wrote:
> [email protected] wrote:
> > 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
>
> It's not the smallest C chess program in the world.
> http://home.hccnet.nl/h.g.muller/max1.html

That page says that its software doesn't even implement
the rules of chess properly .. I don't think that counts



 
Date: 22 Nov 2006 17:32:05
From:
Subject: Re: World smallest chess program

[email protected] 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,=D3scar 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



  
Date: 06 Jan 2007 17:48:37
From: MikeC
Subject: Re: World smallest chess program
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.


<[email protected] > wrote in message
news:[email protected]...

[email protected] 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




  
Date: 28 Nov 2006 01:03:18
From: Keith Thompson
Subject: Re: World smallest chess program
[email protected] writes:
[...]
> P.S.
> This is the world's smallest chess program. It plays legal chess, but
> it will not fare very well in contests:
> #include <stdio.h>
> int main(void)
> {puts("I resign.");return 0;}

<OT >
Reminds me of one of the first programs I wrote (not in C). It would
ask you whether you want to go first. If not, its first move was
always pawn to king 4. After your first move, it would randomly print

Checkmate in [N] moves, (I resign)


 
Date: 22 Nov 2006 16:19:32
From: keith_emerson
Subject: Re: World smallest chess program (corrected)
But where is the setjmp.h???



  
Date: 22 Nov 2006 21:19:39
From: Jack Klein
Subject: Re: World smallest chess program (corrected)
On 22 Nov 2006 16:19:32 -0800, "keith_emerson" <[email protected] >
wrote in comp.lang.c:

> But where is the setjmp.h???

It's a standard header supplied with every standard C compiler. If
your compiler does not have it available, it is either a very strange
non-conforming compiler, or perhaps it is installed incorrectly.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~ajo/docs/FAQ-acllc.html


 
Date: 22 Nov 2006 12:59:00
From:
Subject: World smallest chess program (corrected)
Hi, a year ago I won the 2005 Best Game category
of the International Obfuscated C Code Contest
with a chess program.

http://www.ioccc.org/whowon2005.html
http://www.mailcom.com/ioccc/toledo/hint.htm

But this post is because I have discovered (a
surprise for me) that it is also the world
smallest chess program written in C language.

It has a size of 3004 bytes, or 2261 bytes simply
deleting all the spacing that makes the knight
figure, cutting down the evaluation function would
make it smaller but that deteriorates the computer
gameplay.

By the way, if someone doesn't play chess, here is
a simple modification to make the computer play
versus itself, change 1<L&e to 1

Regards,
=D3scar Toledo G.
http://www.biyubi.com/



  
Date: 23 Nov 2006 00:20:41
From: jacob navia
Subject: Re: World smallest chess program (corrected)
[email protected] wrote:
> Hi, a year ago I won the 2005 Best Game category
> of the International Obfuscated C Code Contest
> with a chess program.
>
> http://www.ioccc.org/whowon2005.html
> http://www.mailcom.com/ioccc/toledo/hint.htm
>
> But this post is because I have discovered (a
> surprise for me) that it is also the world
> smallest chess program written in C language.
>
> It has a size of 3004 bytes, or 2261 bytes simply
> deleting all the spacing that makes the knight
> figure, cutting down the evaluation function would
> make it smaller but that deteriorates the computer
> gameplay.
>
> By the way, if someone doesn't play chess, here is
> a simple modification to make the computer play
> versus itself, change 1<L&e to 1
>
> Regards,
> �scar Toledo G.
> http://www.biyubi.com/
>

And it works!

Incredible!

Mis sinceras felicitaciones. Eso es una obra de arte.

jacob