Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Funny project: Minimum legal chess

Author: Ricardo Gibert

Date: 14:35:33 04/05/00

Go up one level in this thread


On April 05, 2000 at 14:08:01, Dann Corbit wrote:

>It might be funny to write the smallest possible chess program that produces
>legal moves for both sides.  If it plays against itself, it could have no I/O
>except to display the chosen moves.  It could more or less choose legal moves at
>random.  Basically, it could be nothing but a board representation, a move
>generator, and calls to rand().
>
>Can it be done in (for instance) ten lines of C?

The answer is _yes_. Look at your problem description carefully: "...that
produces legal moves for _both_ sides...It _could_ more or less choose legal
moves at random." The following satisfies your problem description:

#include <stdio.h>

int main(void)
{
	puts("1.f3 e5 2.g4 Qh4#");
	return 0;
}

Of course I realize what you meant: "It _must_ choose moves more or less at
random." I'm just having a little fun ;-)





This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.