Author: Robert Hyatt
Date: 20:27:15 07/07/98
Go up one level in this thread
On July 07, 1998 at 23:14:58, Tom Kerrigan wrote: >Yes, this is probably what I will do. > >Anyway, a quick suggestion: what would happen if you separated your piece lists >into piece lists and pawn lists? > >My guess is that you would save a lot of grief in a few places... > >Cheers, >Tom > in cray blitz, my piece list was longer than yours. I used 48 total.. the first 16 were white pieces, the next 8 were white pawns, the next 16 were black pieces, the last 8 were black pawns. I had an index to the last white and black piece to avoid looping over all 24 entries (although on a vector machine the cost for doing so would have been zero). I used 16/8 for promotions... delete a pawn, increment last piece index and store the promote to piece there... >On July 07, 1998 at 22:23:30, Paul Tillotson wrote: > >>Hello. >> >>In my program (which I'm am relatively new to chess programming) is >>to 2 char[64] arrays and 2 char[16] arrays. Basically the board[64] array >>has the current board status. The 2 char[16] arrays are a sorted list of >>the pieces which point to the board[64] array. The other map[64] points to >>the piece list. What this does is allows me to only have 16 iterations >>to generate moves, eval, etc. The map structure allows me to locate where >>the pieces is in the list if there is a capture, etc. >> >>A little example: >>board[1] == N // board piece >>map[1] == 6 // index to piece list >>white_pieces[6] == 1 // index to board array >> >>A full circle. >> >>It may not be helpfull, but it seems to work well for me. >>If this seems insane to anyone please suggest an alternative. >> >>Thanks, >>Paul >> >>On July 07, 1998 at 21:32:42, Tom Kerrigan wrote: >> >>>Yes, the arrays you describe are mandatory if you don't want to spend most of >>>your CPU time looping through the board. :) >>> >>>The problem that I was thinking of, more specifically, is removing an entry from >>>the piece list. >>> >>>Let's say a piece is captured. How do you know which section of the piece list >>>it belongs to? You need a block of code like this: >>> >>>if(color[move.to]==WHITE&&piece[move.to]!=PAWN) >>> remove the piece from the white piece list; >>>if(color[move.to]==WHITE&&piece[move.to]==PAWN) >>> remove the piece from the white pawn list; >>> >>>and so forth. >>> >>>Are there any elegant solutions to this problem? >>> >>>Cheers, >>>Tom >>> >>> >>>On July 07, 1998 at 19:55:12, Robert Hyatt wrote: >>> >>>>On July 07, 1998 at 19:23:39, Tom Kerrigan wrote: >>>> >>>>>I want to write a very small chess program and I'm considering possible methods >>>>>to store a list of pieces. >>>>>Practically every time a chess program loops through a piece list, it's only >>>>>concerned with pieces or pawns of a particular color. Thus, I had this in mind: >>>>> >>>>>int piece_list[32]; >>>>>/* piece_list 0 to 7: white pieces >>>>> piece_list 8 to 15: white pawns >>>>> piece_list 16 to 23: black pieces >>>>> piece_list 24 to 31: black pawns >>>>>*/ >>>>>int white_pieces; >>>>>int white_pawns; >>>>>int black_pieces; >>>>>int black_pawns; >>>>> >>>>>I think this is reasonable until a piece needs to be removed. Then the computer >>>>>needs to figure out which list the piece belongs to, and this sounds >>>>>time-consuming. >>>>>Any comments or suggestions? >>>>> >>>>>Cheers, >>>>>Tom >>>> >>>> >>>>we used this in Cray Blitz. Since you have a board[x] array, use a >>>>pboard[x] array... where if you access pboard[x] it gives you an index >>>>into the piece list rather than the piece on that square. Worked well >>>>for us, although we did it for vector-processing reasons...
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.