-
Notifications
You must be signed in to change notification settings - Fork 3
/
match.cpp
86 lines (69 loc) · 2.05 KB
/
match.cpp
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#include "match.hpp"
void Match::init()
{
for(int botindex=0;botindex<gconst.number_of_bots; botindex++)
{
Player tempplayer=Player(botindex, gconst);
tempplayer.init();
players.push_back(tempplayer);
}
/*
for(int botindexA=0;botindexA<gconst.number_of_bots; botindexA++)
{
for(int botindexB=0;botindexB<gconst.number_of_bots; botindexB++)
{
Constraint tempConstr;
tempConstr.particleA=botindexA;
tempConstr.particleB=botindexB;
tempConstr.active=true;
if(botindexA!=botindexB)
{
if ( std::find(constraints.begin(), constraints.end(), tempConstr) != constraints.end() )
continue;
else
constraints.push_back(tempConstr);
}
}
}
*/
int indexConstrain1=0;
for(int botindexA=0;botindexA<gconst.number_of_bots; botindexA++)
{
for(int botindexB=0;botindexB<gconst.number_of_bots; botindexB++)
{
Constraint tempConstr;
tempConstr.particleA=botindexA;
tempConstr.particleB=botindexB;
tempConstr.active=false;
allconstraints.push_back(tempConstr);
indexConstrain1++;
}
}
int indexConstrain=0;
for(int botindexA=0;botindexA<gconst.number_of_bots-1; botindexA++)
{
for(int botindexB=botindexA+1;botindexB<gconst.number_of_bots; botindexB++)
{
Constraint tempConstr;
tempConstr.particleA=botindexA;
tempConstr.particleB=botindexB;
tempConstr.active=false;
constraints.push_back(tempConstr);
indexConstrain++;
}
}
printf("number of constrains %c \n", (int)(constraints.size()));
}
void Match::clearbotfields(int id)
{
}
void Match::losebots()
{
for(auto bot_id: losers)
{
printf("----- Match over for bot N: %3d \n", bot_id);
players[bot_id-1].active=false;
clearbotfields(bot_id);
}
losers.clear();
}