forked from jp-varela/Genetic-Algorithm-PathFinder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Leaderboard.pde
70 lines (60 loc) · 1.28 KB
/
Leaderboard.pde
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
class team{
float top_score[]={0,0,0,0,0,0};
int team[]={0,1,2,3,4,5};
boolean new_best[] = {false,false,false,false,false,false};
//String[] team_name={"0.1%","0.2%","0.5%","1%","2%","5%"};
String[] team_name={"White","Yellow","Green","Blue","Purple","Red"};
team()
{
}
//update(team, score) update final_pixel here
//int update_pixel(team) return pixel para ir
void reset()
{
for(int i=0; i<6; i++)
top_score[i]=0;
}
void update(float new_score, int t)
{
for(int i=0; i<6; i++)
{
if(new_score>top_score[i])
{
for(int j=5; j>i; j--)
{
top_score[j]=top_score[j-1];
team[j]=team[j-1];
}
top_score[i]=new_score;
team[i]=t;
return;
}
}
}
int get_position(int t)
{
for(int i=0; i<6; i++)
{
if(team[i]==t)
return i;
}
return -1;
}
String get_name(int t)
{
return team_name[t];
}
void reset_new_score()
{
for(int i=0; i<6; i++)
new_best[i]=false;
}
boolean get_new_state(int i)
{
return new_best[i];
}
void set_new_true(int i)
{
new_best[i]=true;
}
}