Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: problems compiling

Author: Alexander Kure

Date: 07:48:15 12/31/01

Go up one level in this thread


Dear Sean,

There are some problems in your code:

1) init.c, function reset_piece_square() (line 31)

   g_pieces[++g_num_pieces] = i;  // index goes from 1 to 33 here!!
   g_squares[i] = g_num_pieces;

instead it should read:

   g_pieces[g_num_pieces] = i;    // first piece gets index 0
   g_squares[i] = g_num_pieces++; // same index assigned to the square

2) move.c, function gen() (line)
   for (i=1; i<=g_num_pieces; i++)  // indexing from 1..32 instead of 0..31!!

   Compare this with the loop in line 67 for black to move
   where you got it right!

instead it should read:

   for (i=0; i<g_num_pieces; i++)   // indexing from 0..31

3) move.c, function make_move(), (line 283)

   g_pieces[g_squares[m.to]] = -1;  // g_squares[m.to] can be -1 if there
                                    // is no piece captured!!

instead it should read:

   // captured piece
   if (g_squares[m.to] != -1)
           g_pieces[g_squares[m.to]] = -1;


Hope this helps!

Greetings
Alex



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.