-
Notifications
You must be signed in to change notification settings - Fork 0
/
Ai.pde
57 lines (47 loc) · 1.35 KB
/
Ai.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
int situation;
void turnAI() {
boolean aiTurn = turn;
int scoreMap[][] ={
{0, 1, 1, 0},
{1, 0, 0, 1},
{1, 0, 0, 1},
{0, 1, 1, 0},
};
int canPutCount=0;
for (int i=0; i<8; i++)
for (int j=0; j<8; j++)
if (canPut(i, j, false))canPutCount++;
canPutCount=(int)random(canPutCount)+1;
for (int i=0; i<8; i++)
for (int j=0; j<8; j++) {
if (canPut(i, j, false))canPutCount--;
if (canPutCount==0) {
canPut(i, j, true);
break;
}
}
//println(canPutCount);
turn^=true;
//switch(situation) {
//case 0: //序盤(4×4内)
// int canPutCount=0;
// for (int i=0; i<4; i++)
// for (int j=0; j<4; j++)
// if (canPut(i+2, j+2, false))canPutCount++;
// int maxScorePointCount=0;
// for (int i=0; i<4; i++)
// for (int j=0; j<4; j++)
// if (canPut(i+2, j+2, false) && scoreMap[i][j]==1)maxScorePointCount++;
// maxScorePointCount=(int)random(maxScorePointCount);
// for (int i=0; i<4; i++)
// for (int j=0; j<4; j++) {
// if (canPut(i+2, j+2, false))maxScorePointCount--;
// if (maxScorePointCount==0)canPut(i+2, j+2, true);
// }
// println(canPutCount);
// if (canPutCount==0)situation++; //序盤終了
// else break;
//case 1: //中盤
//}
//turn^=true;
}