From 411d2f6d6a6e5370d33f0f54b2f2de7147a9d977 Mon Sep 17 00:00:00 2001 From: jacopograndi Date: Mon, 6 Sep 2021 20:11:36 +0200 Subject: started ai --- game/ai/evaluator.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 game/ai/evaluator.h (limited to 'game/ai/evaluator.h') 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 + +#include +#include + +#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 -- cgit v1.2.3-54-g00ecf