Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Simple C questions.

Author: Robert Hyatt

Date: 10:39:35 06/26/99

Go up one level in this thread


On June 26, 1999 at 03:18:11, TEERAPONG TOVIRAT wrote:

>My program uses single array board like TSCP. In the generate movelist  function
>I
>use a lot of if , while statements to check whether it goes outside the board
>such as
>     if (piece(i-5)==EMPTY) add move;
>My question is  do I have to check i is more than 4 ?   What would the compiler
>return if it is piece[-1] or less?    Is this is a potential bug?
>Thanks for any help,
>Regards,
>Teerapong


It will kill you.  piece[-1] is the memory address right before piece[0]
and it probably doesn't contain what you expect it to...



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.