Belofte version 2.1.9
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 * converge score towards zero in order to force immediate best move
12 * first
13 */
15{
16 if (score > 0) {
17 if (score > SCORE_ALMOST_NORMAL) {
18 if (score == SCORE_PUNDEFINED) return SCORE_UNDEFINED;
19 return score;
20 }
21 if (score < SCORE_ALMOST_DRAW) return score;
22 return score - SCORE_CONVERGE_BYDEPTH;
23 } else if (score < 0) {
24 if (score < -SCORE_ALMOST_NORMAL) {
25 if (score == SCORE_PRACTICAL_DRAW) return SCORE_THEORETIC_DRAW;
26 return score;
27 }
28 if (score > -SCORE_ALMOST_DRAW) return score;
29 return score + SCORE_CONVERGE_BYDEPTH;
30 }
31 return score;
32}
33
35{
36 if (!m_type) {
37 if (m_score > SCORE_PUNDEFINED || m_score < SCORE_UNDEFINED) return *this;
38 return bSearchScore(-m_score);
39 } else if (m_type == tScoreType::SC_ALPHA) {
41 } else if (m_type == tScoreType::SC_BETA) {
43 }
44 return bSearchScore(-m_score, m_type);
45}
46
47bSearchScore::operator std::string() const
48{
49 if (!m_type) {
51 } else if (m_type == tScoreType::SC_ALPHA) {
53 } else if (m_type == tScoreType::SC_BETA) {
55 }
57}
58
59//-----------------------------------------------------------------------
60
61// 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()
Definition searchscore.h:95
scoretype_t m_type
static std::string scoreAsString(bScore const score)
constexpr bScore SCORE_ALMOST_NORMAL
Definition eval.h:23
constexpr bScore SCORE_PUNDEFINED
Definition eval.h:20
int16_t bScore
Definition eval.h:11
constexpr bScore SCORE_PRACTICAL_DRAW
Definition eval.h:18
constexpr bScore SCORE_ALMOST_DRAW
Definition eval.h:27
constexpr bScore SCORE_CONVERGE_BYDEPTH
Definition eval.h:30
constexpr bScore SCORE_UNDEFINED
Definition eval.h:21
constexpr bScore SCORE_THEORETIC_DRAW
Definition eval.h:17
#define BETA
Definition search.h:58
#define ALPHA
Definition search.h:57
@ SC_BETA
Definition searchscore.h:15
@ SC_ALPHA
Definition searchscore.h:15