-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathevaluator.h
54 lines (47 loc) · 1.67 KB
/
evaluator.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef _EVALUATOR_H
#define _EVALUATOR_H
#include "board.h"
#include "constants.h"
#include <memory>
typedef int CentipawnScore;
class Evaluator {
public:
virtual ~Evaluator() = default;
virtual CentipawnScore getPieceValue(Piece piece);
virtual CentipawnScore staticEvaluate(const Board& board) = 0;
virtual std::unique_ptr<Evaluator> clone() const = 0;
};
class TrivialEvaluator : public Evaluator {
CentipawnScore staticEvaluate(const Board& board) override {
return 0;
}
std::unique_ptr<Evaluator> clone() const override {
return std::make_unique<TrivialEvaluator>(*this);
}
};
class EvalLevelThree : public Evaluator {
public:
CentipawnScore staticEvaluate(const Board& board) override;
std::unique_ptr<Evaluator> clone() const override {
return std::make_unique<EvalLevelThree>(*this);
}
};
class EvalLevelFour : public Evaluator {
public:
CentipawnScore staticEvaluate(const Board& board) override;
std::unique_ptr<Evaluator> clone() const override {
return std::make_unique<EvalLevelFour>(*this);
}
private:
//Some weights of how good things are in the evaluation, these could
//be implemented as setting without too much effort if we wanted that
static const CentipawnScore TempoBonus = 20;
static const CentipawnScore RookOpenFileBonus = 6;
static const CentipawnScore RookSemiOpenFileBonus = 6;
static const CentipawnScore QueenOpenFileBonus = 2;
static const CentipawnScore QueenSemiOpenFileBonus = 3;
static const CentipawnScore BishopPairBonus = 30;
static const CentipawnScore IsolatedPawnBonus = -10;
static const CentipawnScore PassedPawnBouns = 80;
};
#endif