-
Notifications
You must be signed in to change notification settings - Fork 0
/
MaxSpeedStrategy.h
66 lines (56 loc) · 1.64 KB
/
MaxSpeedStrategy.h
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#pragma once
#include "Strategy.h"
#include "Defines.h"
#include "KnownPlayer.h"
#include "Point.h"
#include <deque>
#include <random>
#include <set>
class Context;
struct FoodSeen {
Point pos;
int tick;
};
struct EnemySeen
{
PartId id;
int tick;
};
class MaxSpeedStrategy : public Strategy {
constexpr static int food_shelf_life = 350;
constexpr static int angle_partition_count = DEBUG_RELEASE_VALUE(20, 40);
constexpr static int future_scan_iteration_count =
DEBUG_RELEASE_VALUE(10, 20);
constexpr static int remember_enemies_tick_count = 100;
public:
MaxSpeedStrategy();
Point border_point_by_vector(const Point &v);
Response get_response(const Context &context) override;
void initialize(const GameConfig &config) override;
private:
Response move_by_vector(const Point &v);
void calculate_fusions(const std::vector<KnownPlayer> &enemies);
int get_scan_precision() const;
double calc_target_score(const Point &target);
bool is_splitting_dangerous() const;
Response get_response_impl();
void remove_eaten_food();
void remove_stale_food();
void add_new_food_to_seen();
void update();
private:
std::deque<FoodSeen> m_food_seen;
std::multiset<Point> m_food_seen_set;
std::vector<KnownPlayer> m_fusions;
std::vector<KnownPlayer> m_predicted_enemies;
std::deque<EnemySeen> m_enemies_seen;
std::multiset<double> m_enemies_masses;
std::string m_debug;
std::vector<int> m_fused; // 1 - checked, 2 - fused for real
#ifdef CUSTOM_DEBUG
std::vector<std::array<Point, 2>> m_debug_lines;
std::vector<std::string> m_debug_line_colors;
#endif;
const Context *ctx;
mutable std::default_random_engine m_re;
};