aboutsummaryrefslogtreecommitdiff
path: root/game/ai/evaluator.h
diff options
context:
space:
mode:
authorjacopograndi <jak.sk8@hotmail.it>2021-09-06 20:11:36 +0200
committerjacopograndi <jak.sk8@hotmail.it>2021-09-06 20:11:36 +0200
commit411d2f6d6a6e5370d33f0f54b2f2de7147a9d977 (patch)
tree82b631079a3d7226ce6384f695f2e3b213a2c635 /game/ai/evaluator.h
parent522a43d16e812e10ff69747ee916918b4bd29f2f (diff)
started ai
Diffstat (limited to 'game/ai/evaluator.h')
-rw-r--r--game/ai/evaluator.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/game/ai/evaluator.h b/game/ai/evaluator.h
new file mode 100644
index 0000000..75684de
--- /dev/null
+++ b/game/ai/evaluator.h
@@ -0,0 +1,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 \ No newline at end of file