-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAI.h
51 lines (39 loc) · 1020 Bytes
/
AI.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
#pragma once
#include <vector>
#include <list>
#include <set>
#include <QJsonObject>
#include <QJsonArray>
#include <QJsonDocument>
#include "Train.h"
class AI {
private:
AI();
static AI* uniqueInstance;
std::vector<std::list<int>> _graph[7];
std::vector<std::list<int>> _bigGraph;
int** successor;
int** D;
int n;
public:
static AI* instance();
// AI functions
int nextStationInShortestPath(int x, int y);
int distance(int x, int y) { return D[x][y]; }
void findFinalStations(int startStation, int shape, std::vector<int> &v);
void update();
// Small Graphs functions
void clearGraph();
void deleteGraphLine(int lineIndex);
void addStation();
void addLink(int x, int y, int lineIndex);
void printGraph();
void setOriented(bool oriented, int firstStation, Train* train);
// Big Graph functions
void clearBigGraph() { _bigGraph.clear(); }
void printBigGraph();
void updateBigGraph();
// Savegame functions
void read(const QJsonObject& json);
void write(QJsonObject& json) const;
};