Author: Bruce Moreland
Date: 19:06:36 07/07/98
Go up one level in this thread
On July 07, 1998 at 21:32:42, Tom Kerrigan wrote: >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? An if-then-else would clean this up a bit, although I'm sure the compiler knows what you mean anyway. You can make a doublly linked list, and organize it in such a way that the thing doesn't have to worry about which list it's operating on. If I understand what you are doing, it doesn't matter what you do as long as it works and doesn't drive you insane. bruce
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.