Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: question about implementing tablebases

Author: Dann Corbit

Date: 19:55:01 12/10/04

Go up one level in this thread


On December 10, 2004 at 22:18:12, Uri Blass wrote:

>On December 10, 2004 at 22:06:09, Andrew Platt wrote:
>
>>On December 10, 2004 at 21:21:10, Uri Blass wrote:
>>
>>>On December 10, 2004 at 20:41:06, Dann Corbit wrote:
>>>
>>>>Did you read this:
>>>>
>>>>How to integrate my probing code into your chess program
>>>>========================================================
>>>
>>>I did not but I still do not understand some things when I look at it
>>>for example the function
>>>SqFindKing   (square *)
>>>
>>>What king does it find white or black and why does it need to get pointer to
>>>square?
>>>I can find the white king or black king with no pointers.
>>
>>Caveat: I haven't implemented it either but I think I can understand the
>>specification clearly enough. Note there are two arrays, one for each color. The
>>parameter 'square *' is simply one of those arrays. So it will look for the king
>>in the array you pass.
>>
>>Andy.
>
>In this case I do not understand why it gets a pointer.
>
>getting a pointer is done when you think to change the value.
>I see no reason to change the side to move so it could simply get side to move
>as a paramater.

In C and C++, an array reference always decays to a pointer in a function call.

Have you seen this document:
ftp://rtfm.mit.edu/pub/usenet-by-group/comp.lang.c/C-FAQ-list

If you want to protect the value you can make it a pointer to const.
You can also pass the whole array by value by wrapping it in a struct (which is
not usually a good idea unless the array is small).



This page took 0.01 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.