Author: David Mitchell
Date: 23:54:07 03/07/04
Go up one level in this thread
On March 07, 2004 at 19:43:17, Joshua Shriver wrote:
>What is the best way to store the data for a move generator?
>Right now I'm implementing it as a tree:
>
>struct ChessNode {
> int piece;
> int color; /* 0 = white, 1 = black */
> struct ChessNode* one;
> struct ChessNode* two;
> struct ChessNode* three;
> struct ChessNode* four;
> struct ChessNode* five;
> struct ChessNode* six;
> struct ChessNode* seven;
> struct ChessNode* eight;
> struct ChessNode* nine;
> struct ChessNode* ten;
> struct ChessNode* eleven;
> struct ChessNode* twelve;
> struct ChessNode* thirteen;
> struct ChessNode* fourteen;
> struct ChessNode* fifthteen;
> struct ChessNode* sixteen;
> struct ChessNode* seventeen;
> struct ChessNode* eighteen;
>};
>
>Using all 18 pieces, since you can assume it should work with all 18 pieces
>taken into consideration. However after x moves from the opening book, this
>should bring that down a good bit.
>
>I'm doing brute-force at the moment just to get into the swing of things before
>implementing pruning. So this'll be rather weak.
>
>Is this the best way to go about it? Or is there a more efficient way of holding
>the data for a move generator if not a tree.
>
>Sincerely,
>Joshua Shriver
>jshriver at csee dot wvu dot edu
You're trying to build a c.s. type tree, maybe?
Chess tree's are _much_ too large for that! That's why we use a depth first
search, not a breadth first, or some other style of searching.
Just an array to hold the moves should be fine. Each ply in the array holds a
ply worth of possible moves in the game.
TSCProgram will enlighten you.
dave
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.