-
Notifications
You must be signed in to change notification settings - Fork 0
/
Evaluator.h
74 lines (66 loc) · 2.01 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/* =============================================================================
# FileName: Evaluator.h
# Desc: Base class for evaluation function
# Author: YanlongLi
# Email: [email protected]
# HomePage: http://www.yanlongli.me
# Created: 2017-10-14 22:08:36
# Version: 0.0.1
# LastChange: 2017-10-14 22:08:36
# History:
# 0.0.1 | YanlongLi | init
============================================================================= */
#ifndef EVALUATOR_H
#define EVALUATOR_H
#include "Board.h"
class Evaluator {
protected:
/*
* Generate random float value between [0.0, 1,0)
*/
double randomFloat();
public:
Evaluator() {}
virtual ~Evaluator() {}
virtual double maxerEvaluation(const Board& board) = 0;
virtual double minerEvaluation(const Board& board) = 0;
};
/*
* Simple evaluator, compute the the difference of work number
*/
class SimpleEvaluator : public Evaluator {
public:
virtual ~SimpleEvaluator() {}
virtual double maxerEvaluation(const Board& board);
virtual double minerEvaluation(const Board& board);
};
/*
* 2*(number_of_own_pieces_remaining)
*/
class DefensiveHeuristicEvaluator : public Evaluator {
public:
virtual ~DefensiveHeuristicEvaluator() {}
virtual double maxerEvaluation(const Board& board);
virtual double minerEvaluation(const Board& board);
};
/*
* 2*(30 - number_of_opponent_pieces_remaining)
*/
class OffensiveHeuristicEvaluator : public Evaluator {
public:
virtual ~OffensiveHeuristicEvaluator() {}
virtual double maxerEvaluation(const Board& board);
virtual double minerEvaluation(const Board& board);
};
/*
* average distance of n workers that far from base
*/
class DistanceFromBaseEvaluator: public Evaluator {
int top;
public:
DistanceFromBaseEvaluator(int _top);
virtual ~DistanceFromBaseEvaluator() {}
virtual double maxerEvaluation(const Board& board);
virtual double minerEvaluation(const Board& board);
};
#endif /* ifndef EVALUATOR_H */