aboutsummaryrefslogtreecommitdiff
path: root/game/ai/evaluator.h
blob: 75684de9dc2fbf4f14c7f86541097e9824d97b28 (plain)
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
#ifndef EVALUATOR_H
#define EVALUATOR_H

#include <iostream>

#include <string>
#include <vector>

#include "../ground.h"
#include "../gst.h"

namespace ai {

class evaluator {
    public:
    evaluator (Gst gst) : gst(gst) {}
    Gst gst;
    
    float eval (int player) {
        float val = 0;
        for (Entity &ent : gst.entities) {
            int own = (int)(ent.owner != player)*2-1;
            val += own*(ent.info->cost[0] + ent.info->cost[1])*(ent.hp/100.0f);
        }
        return val;
    }
};

}
#endif