Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Where should i Get started...

Author: Dann Corbit

Date: 22:31:00 07/12/02

Go up one level in this thread


On July 13, 2002 at 01:12:54, Russell Reagan wrote:

>On July 13, 2002 at 00:03:19, Dann Corbit wrote:
>
>>Simple programs:
>>TSCP {lacks hash table and move list}
>>Olithink {lacks move list}
>>MSCP {lacks move list}
>>SCP {Has a move list, but lacks other things}
>
>What do you mean by "lacks move list"? Are you talking about the game's home
>history or what?

Many chess programs have either a move list or something that serves the purpose
of a move list.

Instead of searching 64 squares to see what's on them, we look right at the
pieces themselves, which are stored in a list.

Often, there are even separate lists.

In Beowulf, the piece bitmaps serve as move lists.  You will see stuff like
this:

    /* Loop through all pieces, adding up their basic scores */
    /* White pieces */
    pieces = B->WhitePawns;
    while (pieces) {
        sq = FirstPiece(pieces);
        score += PAWN_SCORE + PawnPosition[B->Gamestage][sq];
        LastWhitePawn[File(sq)] = sq;
        Pawns[npawns++] = sq;
        RemoveFirst(pieces);
    }
    pieces = B->WhiteRooks;
    while (pieces) {
        sq = FirstPiece(pieces);
        score += ROOK_SCORE + RookPosition[sq];
        wmaj++;
        RemoveFirst(pieces);
    }
    pieces = B->WhiteKnights;
    while (pieces) {
        sq = FirstPiece(pieces);
        score += KNIGHT_SCORE + KnightPosition[sq];
        wmin++;
        RemoveFirst(pieces);
    }
    pieces = B->WhiteBishops;
    while (pieces) {
        sq = FirstPiece(pieces);
        score += BISHOP_SCORE + BishopPosition[sq];
        wmin++;
        RemoveFirst(pieces);
    }
    pieces = B->WhiteQueens;
    while (pieces) {
        sq = FirstPiece(pieces);
        score += QUEEN_SCORE + QueenPosition[sq];
        if (B->Gamestage <= Middle && Rank(sq) < Rank5)
            score -= OVERSTRETCHED * (1 + Middle - B->Gamestage);
        wmaj += 2;
        RemoveFirst(pieces);
    }

    /* Black pieces */
    pieces = B->BlackPawns;
    while (pieces) {
        sq = FirstPiece(pieces);
        score -= (PAWN_SCORE + PawnPosition[B->Gamestage][(Flip[sq])]);
        if (LastBlackPawn[File(sq)] == 64)
            LastBlackPawn[File(sq)] = sq;
        Pawns[npawns++] = sq;
        RemoveFirst(pieces);
    }
    pieces = B->BlackRooks;
    while (pieces) {
        sq = FirstPiece(pieces);
        score -= (ROOK_SCORE + RookPosition[(Flip[sq])]);
        bmaj++;
        RemoveFirst(pieces);
    }
    pieces = B->BlackKnights;
    while (pieces) {
        sq = FirstPiece(pieces);
        score -= (KNIGHT_SCORE + KnightPosition[(Flip[sq])]);
        bmin++;
        RemoveFirst(pieces);
    }
    pieces = B->BlackBishops;
    while (pieces) {
        sq = FirstPiece(pieces);
        score -= (BISHOP_SCORE + BishopPosition[(Flip[sq])]);
        bmin++;
        RemoveFirst(pieces);
    }
    pieces = B->BlackQueens;
    while (pieces) {
        sq = FirstPiece(pieces);
        score -= (QUEEN_SCORE + QueenPosition[(Flip[sq])]);
        if (B->Gamestage <= Middle && Rank(sq) > Rank4)
            score -= OVERSTRETCHED * (1 + Middle - B->Gamestage);
        bmaj += 2;
        RemoveFirst(pieces);
    }


Here is formation of the movelist from SCP:
/*--> MoveList: generate a movelist into the global tree vector */
static
void
MoveList(siT side, siT ply)
{
/*

Fill the array Tree[] with all available moves for side to
play. Array TrPnt[ply] contains the index into Tree[]
of the first move at a ply.

*/

siT i;
siT ok, xside;

xside = otherside[side];
TrPnt[ply + 1] = TrPnt[ply];
Dstart[pawn] = Dstpwn[side];
Dstop[pawn] = Dstart[pawn] + 1;

for (i = 0; i <= PieceCnt[side]; i++)
	GenMoves(ply, PieceList[side][i], side, xside);

if (kingmoved[side] == 0)
	{
	Castle(side, 255, 0, 0, &ok);
	if (ok)
		LinkMove(ply, 255, 0, side, xside);

	Castle(side, 0, 255, 0, &ok);
	if (ok)
		LinkMove(ply, 0, 255, side, xside);
	};

SortSegment(TrPnt[ply], TrPnt[ply + 1] - 1);

return;
}



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.