Scid  4.7.0
recog.h
Go to the documentation of this file.
1 //////////////////////////////////////////////////////////////////////
2 //
3 // FILE: recog.h
4 // Endgame knowledge recognition class
5 //
6 // Part of: Scid (Shane's Chess Information Database)
7 // Version: 3.4
8 //
9 // Notice: Copyright (c) 2002 Shane Hudson. All rights reserved.
10 //
11 // Author: Shane Hudson (sgh@users.sourceforge.net)
12 //
13 //////////////////////////////////////////////////////////////////////
14 
15 #include "engine.h"
16 #include "position.h"
17 
18 // Recognition value conversion: a recognition score contains a
19 // regular score shifted left 4 bits to make room for a score flag.
20 
21 inline int recogValue (scoreFlagT flag, int score) {
22  return ((score * 16) | flag);
23 }
24 inline int recogScore (int value) { return value / 16; }
25 inline scoreFlagT recogFlag (int value) { return value & 15; }
26 
27 // The Recognizer class provides score bound information for chess endgames.
28 namespace Recognizer {
29 
30 constexpr uint MaxPieces() {
31  // Only positions with a total of 6 or fewer pieces (including kings
32  // and pawns) are potentially recognizable.
33  return 6;
34 }
35 int Recognize(Position* pos);
36 
37 } // namespace Recognizer
38 
39 //////////////////////////////////////////////////////////////////////
40 // EOF: recog.h
41 //////////////////////////////////////////////////////////////////////
int Recognize(Position *pos)
Definition: recog.cpp:45
constexpr uint MaxPieces()
Definition: recog.h:30
scoreFlagT recogFlag(int value)
Definition: recog.h:25
uint32_t uint
Definition: common.h:91
byte scoreFlagT
Definition: engine.h:49
int recogScore(int value)
Definition: recog.h:24
int recogValue(scoreFlagT flag, int score)
Definition: recog.h:21