-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexpectimax.h
More file actions
48 lines (37 loc) · 1.24 KB
/
expectimax.h
File metadata and controls
48 lines (37 loc) · 1.24 KB
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
#pragma once
#include "action.h"
#include "worldState.h"
// To enable threading:
#define USE_THREADS
// Recording Action History (slightly slows down program)
// #define RAH
struct ActionEvaluationResult
{
Action::Identifier actionIdentifier;
std::vector<Action::Identifier> actionHistory;
float score;
};
// This algorithm will evaluate a set of actions and return the best action to choose.
class Expectimax
{
public:
Expectimax();
Action::Identifier evaluateAction(WorldState worldState);
typedef std::vector<Action> ActionVector;
ActionVector actions;
private:
std::pair<float, Action::Identifier> evaluateNoConditionsNoFailure(const WorldState& worldState, int depth
#ifdef RAH
, std::vector<Action::Identifier>& actionHistory
#endif
);
float fitness(const WorldState & worldState);
std::map<WorldState::Condition, float> conditionMap(WorldState::Condition condition);
int maxDepth;
float pGood = 0.23;
float pExcellent = 0.01;
int terminalWorldsEvaluated = 0;
bool considerExcellentCondition = false;
inline ActionEvaluationResult getActionScore(const WorldState &worldState, int depth, Action::Identifier actionIdentifier);
float earlyAbandonmentScore = 0;
};