Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Chess programming puzzle

Author: Anthony Cozzie

Date: 14:05:25 02/22/05

Go up one level in this thread


On February 22, 2005 at 16:29:40, Alessandro Scotti wrote:

>On February 22, 2005 at 15:37:44, Scott Gasch wrote:
>
>>Yours was hard to compile.. I had to add a main function and use -std=c99 to get
>> the for loops to work.  Also had to use gcc instead of g++.
>>
>>[ scott@wannabe:~/tmp ] % gcc34 -O -S -std=c99 wagner.c ; wc -l wagner.s
>>     118 wagner.s
>
>It can get worse though... :-)
>
>#include <stdio.h>
>
>int main( void )
>{
>    for( int nn=0; nn<4096; nn++ )
>        if( (nn & (nn >> 6)) == 0 ) {
>            for( int empty=0, sq=0; sq < 64 || printf( empty ? "%d w - - 0 1\n"
>: " w - - %d 1\n", empty ) == 0; sq++ ) {
>                if( (sq % 8) == 0 || sq == (nn & 0x3F) || sq == (nn >> 6) ) {
>                    printf( empty ? "%d%s%s" : "%*s%s", empty, "", sq && (sq %
>8) == 0 ? "/" : "" );
>                    empty = -printf( "%s", sq == (nn & 0x3F) ? "n" : sq == (nn
>>> 6) ? "N" : "" );
>                }
>                empty++;
>            }
>        }
>
>    return 0;
>}

very cute!

anthony



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.