Belofte version 2.2.0
A promising chess program using the UCI or Winboard interface
searchscore.cpp
Go to the documentation of this file.
1/*---------------------------------------------------------------------+
2 * File: searchscore.cpp
3 * Project: part of belofte - A Promising Chess Program
4 * Author: yves
5 * SPDX-License-Identifier: GPL-2.0-only
6+----------------------------------------------------------------------*/
7
8#include "belofte.h"
9
10/**
11 * @static Class static function
12 * converge score towards zero in order to force immediate best move
13 * first
14 */
16{
17 if (score > 0) {
18 if ((score > SCORE_ALMOST_NORMAL) || (score < SCORE_ALMOST_DRAW)) return score;
19 return score - SCORE_CONVERGE_BYDEPTH;
20 }
21 if ((score < -SCORE_ALMOST_NORMAL) || (score > -SCORE_ALMOST_DRAW)) return score;
22 return score + SCORE_CONVERGE_BYDEPTH;
23}
24
26{
27 if (!m_type) {
29 return bSearchScore(-m_score);
30 } else if (m_type == tScoreType::SC_ALPHA) {
32 } else if (m_type == tScoreType::SC_BETA) {
34 }
35 return bSearchScore(-m_score, m_type);
36}
37
38bSearchScore::operator std::string() const
39{
40 if (!m_type) {
42 } else if (m_type == tScoreType::SC_ALPHA) {
44 } else if (m_type == tScoreType::SC_BETA) {
46 }
48}
49
50//-----------------------------------------------------------------------
51
52// eof
This is the main include file, needs to be included before any other include.
bSearchScore operator-() const
bSearchScore(bSearchScore &sc)
Definition searchscore.h:25
bScore convergeScore()
scoretype_t m_type
static std::string scoreAsString(bScore const score)
constexpr bScore SCORE_ALMOST_NORMAL
Definition eval.h:22
int16_t bScore
Definition eval.h:11
constexpr bScore SCORE_ALMOST_DRAW
Definition eval.h:24
constexpr bScore SCORE_CONVERGE_BYDEPTH
Definition eval.h:27
#define BETA
Definition search.h:73
#define ALPHA
Definition search.h:72
@ SC_BETA
Definition searchscore.h:15
@ SC_ALPHA
Definition searchscore.h:15