Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: These are not PSTs

Author: Harald Lüßen

Date: 11:32:26 09/23/04

Go up one level in this thread


On September 23, 2004 at 13:31:10, Dan Honeycutt wrote:

>On September 23, 2004 at 12:39:11, Stuart Cracraft wrote:
>
<snip>
>>
>>I lied -- I actually do use these as my PST's. I also use these for move
>>ordering (e.g. movescore+=historyheuristic+see(ifcapture)+pst[to]-pst[from]+
>>somebonusifcastlemove+somepromotion)
>>
>>Stuart
>
>What sort of values does your historyheuristic have?  Mine has numbers in the
>thousands or tens of thousands so in a formula like you have the see(), pst[]
>and castlebonus values would do nothing.

You can scale them to a fixed range with a max_value like this:

/**
Reset the history table.
All counters are set to 0.
*/
void HistoryTable::reset()
{
    history_table_.clear();
    history_table_.resize( 8 * 64 * 64 );
    max_value_ = 0;
}

void HistoryTable::reduce()
{
    for ( int i = 0; i < 8 * 64 * 64; ++i )
    {
        history_table_[i] >>= 8;
    }
    max_value_ >>= 8;
}

#define HISTORY_TABLE_MAX_DISTANCE  16
#define HISTORY_TABLE_MAX_COUNTER   10000

/**
Store a move in the history table if it is not a capture.
The counter is incremented by distance * distance.
The distance is pure ply distance, not PLY_STEPS().
*/
void HistoryTable::store( const Move &move, int distance )
{
    if ( move.captured_piece() == NoPieceNr )
    {
        int index = (move.moving_piece() << 12)
                  + (move.to() << 6) + move.from();
        if ( distance > HISTORY_TABLE_MAX_DISTANCE )
            distance = HISTORY_TABLE_MAX_DISTANCE;
        history_table_[index] += distance * distance;
        max_value_ = max( max_value_, history_table_[index] );
        if ( history_table_[index] > HISTORY_TABLE_MAX_COUNTER )
        {
            reduce();
        }
    }
}

/**
Get counter of a move from the history table.
For bad moves history is 0, for good moves it is 256.
*/
int HistoryTable::lookup( const Move &move ) const
{
    int index = (move.moving_piece() << 12) + (move.to() << 6) + move.from();
    if ( max_value_ )
    {
        return (history_table_[index] << 8) / max_value_;
    }
    else
    {
        return 0;
    }
}

The history counter is now compatible with PSTs, piece values,
centiplies or whatever. Try it with pruning or extensions and
don't get lost with it like me.

Harald



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.