-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathh_complete.dart
63 lines (57 loc) · 1.64 KB
/
h_complete.dart
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
List<int> h_over(
int p1 , int p2 , int id1 , List<int> id2 ,
Node n , List<Cell> cell , List<Agent> player , List<Tree> tree )
{
List<int> k = [ 0 , 0 ];
if( player[p1].state == ENDING )
{
int n = 0;
for( final _ in tree )
if( _.isMine == p1 && _.size == 3 ) n++;
if( n >= (24 - player[p1].day) )
{
k[p1] = k[p1] + (player[p1].nutrients + cell[id1].richness) * 3;
}
}
else
if( player[p1].state == SCORING )
{
int nDay = (24 - player[p1].day) ~/ 6 + 1;
k[p1] = k[p1] - n.cost;
k[p1] = k[p1] + (player[p1].nutrients + cell[id1].richness) * 3;
for( int d = 0 ; d < 6 ; d++ )
{
int g1 = 0 , g2 = 0;
int g = nDay;
for( final int hex in kFUZZY_NEIGH[id1][d] )
{
if( tree[hex].isMine == p1 && g != 0 )
{
g1 = 0;
g = 0;
}
if( tree[hex].isMine == p2 && g != 0)
{
// Depends of the F.S.M.
g2 = g;
g = 0;
}
if( id2.contains(hex) )
{
// Depends of the F.S.M.
;
}
if( p1 == kFUZZY_NEIGH[id1][d].length && g != 0 )
{
g1 = g;
g = 0;
}
}
g1 = g;
k[p1] = k[p1] - 3 * g1;
k[p2] = k[p2] + 3 * g2;
}
}
//error("[${id1}] >> over k ${k} id2 ${id2}");
return k;
}