aboutsummaryrefslogtreecommitdiff
path: root/game/ai/evaluator.h
blob: b2880767702124c7233847182e7ea2dd0a44789b (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