-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathBestMove.java
More file actions
35 lines (31 loc) · 1.02 KB
/
BestMove.java
File metadata and controls
35 lines (31 loc) · 1.02 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
import java.io.Serializable;
/**
* The BestMove objects are a transparent structure to have places to keep
* track of the best moves seen by each thread as they search
*
*/
public class BestMove implements Serializable {
private static final long serialVersionUID = 7218269248347381737L;
public Move move;
public int value;
public int movesExamined;
public BestMove(boolean maximize) {
value = maximize ? LiteUtil.MIN_VALUE : LiteUtil.MAX_VALUE;
movesExamined = 0;
move = null;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder("Move: ");
if (move == null) {
builder.append("null");
} else {
builder.append(
String.format("%c%d to %c%d",
move.getFromCol() + 'a', 8 - move.getFromRow(),
move.getToCol() + 'a', 8 - move.getToRow()));
}
builder.append(String.format(" Value: %,12d", value));
return builder.toString();
}
}