Author: Uri Blass
Date: 20:26:10 12/10/04
Go up one level in this thread
On December 10, 2004 at 22:55:01, Dann Corbit wrote: >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). You are right I simply forgot that it gets an array because array is not needed to find the square of the king (kingsquare[0] is the white king and kingsquare[1] is the black king so I can get only one number and did not see the point of getting an array). I guess that I need first to have function to calculate the array one for each colour because I have not them in movei. I have arrays for pieces of one type but not for all the white pieces. It is still not clear to me what array exactly I should give the function and square* suggest that it should be array of squares but I do not see how array of squares can be relevant only for one side because squares can be of black pieces and of white pieces. Uri
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.