Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Chess programming puzzle

Author: J. Wesley Cleveland

Date: 09:22:52 02/23/05

Go up one level in this thread


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

There is one small error

>
>#include <stdio.h>
>
>int main( void )
>{
>    for( int nn=0; nn<4096; nn++ )

>        if( (nn & (nn >> 6)) == 0 ) {
should be
         if( ((nn &0x3f) ^ (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;
>}



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.