libkombilo  0.8
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends
Algo_hash Class Reference

Base class for hashing for general type patterns (currently works only for corner patterns). More...

#include <algos.h>

Inheritance diagram for Algo_hash:
Algorithm Algo_hash_corner

Public Member Functions

 Algo_hash (int bsize, SnapshotVector DATA, string OS_DATA_NAME, int MAXNUMSTONES)
 
virtual void initialize_process ()
 Called by GameList::start_processing.
 
virtual void newgame_process (int game_id)
 Called when a new game is about to be GameList::process'ed.
 
virtual void AB_process (int x, int y)
 Called during processing, for each AB SGF tag.
 
virtual void AW_process (int x, int y)
 Called during processing, for each AW SGF tag.
 
virtual void AE_process (int x, int y, char removed)
 Called during processing, for each AE SGF tag.
 
virtual void endOfNode_process ()
 Called during processing, after fully processing a node (which might contain several AB, AW tags)
 
virtual void move_process (Move m)
 Called during processing, for each move (B, W tags)
 
virtual void pass_process ()
 Called during processing, for each pass.
 
virtual void branchpoint_process ()
 Called during processing, for each node where a variation starts.
 
virtual void endOfVariation_process ()
 Called during processing, when reaching the end of variation ("jump back to most recent branchpoint")
 
virtual void endgame_process (bool commit=true)
 Called during processing, when the end of the game is reached.
 
virtual void finalize_process ()
 Called by GameList::finalize_processing.
 
virtual int search (PatternList &patternList, GameList &gl, SearchOptions &options)
 
- Public Member Functions inherited from Algorithm
 Algorithm (int bsize)
 

Protected Member Functions

SnapshotVector get_data ()
 Extract the relevant data from file at Kombilo startup.
 
virtual void get_HHCS (int ptr, vector< HashhitCS * > *results, bool cs)
 
virtual std::pair< hashtype, std::vector< int > > compute_hashkey (PatternList &pl, int CS)
 

Protected Attributes

int maxNumStones
 
std::vector< HashInstance > * hi
 
std::vector< std::pair< hashtype, int > > hash_vector
 
vector< pair< hashtype, int > > data
 
boost::unordered_multimap< hashtype, pair< int, int > > data_p
 
fstream os_data
 

Static Protected Attributes

static const hashtype hashCodes []
 

Friends

class GameList
 
class Algo_hash_full
 
class HashInstance
 

Additional Inherited Members

- Data Fields inherited from Algorithm
int gid
 store the game id during processing
 
int boardsize
 board size
 

Detailed Description

Base class for hashing for general type patterns (currently works only for corner patterns).

Member Function Documentation

void Algo_hash::get_HHCS ( int  ptr,
vector< HashhitCS * > *  results,
bool  cs 
)
protectedvirtual

takes a pointer to os_data, a vector results, and a bool cs (==colorSwitch) and adds the hits from the database to the results vector:

int Algo_hash::search ( PatternList patternList,
GameList gl,
SearchOptions options 
)
virtual

Do a pattern search for the Pattern specified by patternList, in the GameList gl.

This computes the hashCode for the given pattern, looks it up in the database, and turns all records found there into Candidate entries which can be used by Algo_movelist::search If more than one corner lies inside the pattern, the hashCode for the corner which contains most stones is used.

Reimplemented from Algorithm.


The documentation for this class was generated from the following files: