-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAi.java
More file actions
94 lines (81 loc) · 3.57 KB
/
Ai.java
File metadata and controls
94 lines (81 loc) · 3.57 KB
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
87
88
89
90
91
92
93
94
import java.util.LinkedList
public class Ai
{
//Ai will view gameboard as -1 for enemy, 0 for empty, 1 for ai
private int[4][8] gameBoard;
private LinkedList() possibleMoves;
//Updates possibleMoves, to be called each turn
//Currently only seeks open spots, possible attacks need figured out
public void updatePossibleMoves()
{
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 8; j++)
{
if (gameBoard[i][j] == 1)
{
if ((j+1) % 2 == 0 && (i) != 3)
{
if (gameBoard[i][j+1] = 0)
{
possibleMoves.add(Integer.toString(i) +
" : "
Integer.toString(j+1));
}
if (gameBoard[i+1][j+1] = 0)
{
possibleMoves.add(Integer.toString(i+1) +
" : "
Integer.toString(j+1));
}
}
else if ((j+1) % 2 == 0 && (i) == 3)
{
if (gameBoard[i][j+1] = 0)
{
possibleMoves.add(Integer.toString(i) +
" : "
Integer.toString(j+1));
}
}
else if (i != 0)
{
if (gameBoard[i][j+1] = 0)
{
possibleMoves.add(Integer.toString(i) +
" : "
Integer.toString(j+1));
}
}
else
{
if (gameBoard[i][j+1] = 0)
{
possibleMoves.add(Integer.toString(i) +
" : "
Integer.toString(j+1));
}
if (gameBoard[i-1][j+1] = 0)
{
possibleMoves.add(Integer.toString(i-1) +
" : "
Integer.toString(j+1));
}
}
}
}
}
}
//Updates gameBoard, to be called each turn
public void updateGameBoard()
{
}
//Evaluates each node and returns the best option
public int miniMax()
{
}
//Evaluates a given node and returns the risk/reward
public int evaluate()
{
}
}