Author: Scott Gasch
Date: 12:02:06 10/07/99
Go up one level in this thread
On October 07, 1999 at 05:32:38, Fernando Rodriguez wrote: ... >in the square e4 is found a pawn, and I have thought that if not serious >possible to make it inside out, the pawn is found in the square e4. Seems that >it is the same, and in fact, the end is the same, but it is possible that this >method could have additional benefits. In my chess engine I do both -- keep a board (array of squares) and a piece list (mapping of piece->location on board). As you say, there are times when each is useful. >For example, each piece would have its >value updated in each position, we just have to add the value of each piece of >all those which have the same color. It is true that doing this with a piece list would save you from searching over the board looking for pieces and adding up values. I find that it is even easier to maintain side strength (e.g. white_strength / black_strength) in the position itself. When pieces are captured I reduce strength in the MakeMove() routine... >The function of creating a possible play >list would be delegated, not to a function concretely, each piece is >responsible >creating its own list of possible moves. This is interesting. In some situations (endgames) I think having the pieces consider the locations of the other living pieces on the list might be faster than using a board. But I think in positions where there are a lot of living pieces it is cheaper to search the board / target square. >Implementing it is quite different, >instead of saying square[8][8] we would have to say piece[2][16] or we would >create a dynamic list, when a piece is eliminated, it is not necessary to >maintain it in the list. I experimented with this as a linked list a little but it turns out, as you would expect, to be a pain in the butt. Instead I do pieceloc[2][16] and have a location in each member. I have a "DEAD" location also (one that cooresponds to no location on the board) to designate captured pieces. The indexes into the piece array are constant, too... that is, a king is at index zero so I can do pieceloc[WHITE][0] or better yet pieceloc[WHITE][KING] to get it's location. I am sure other people are doing this too.. it really speeds up check detection (you don't have to search for the king), move generation (you don't have to find the pieces), etc. This improvement was responsible for a large speed increase in my engine. As far as getting rid of the board altogether, I don't know if that's a good idea. There are places where you need it, I think. Scott
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.