--- a/org/homelinux/largo/schach/KIBoard.java
+++ b/org/homelinux/largo/schach/KIBoard.java
@@ -81,7 +81,7 @@
* The Turn will flip automatically if "simulate(...)" finds a valid move.
*/
Move simulate(int t, int o) {
- Move move = null;
+ Move move;
int value;
if ( validTurn(o) ) {
@@ -111,7 +111,7 @@
int max_alpha_beta (int depth, int alpha, int beta) {
int moveValue;
int o, t;
- Move move = null;
+ Move move;
if ( desired_depth == -1 )
desired_depth = depth;
@@ -150,7 +150,7 @@
int min_alpha_beta(int depth, int alpha, int beta) {
int moveValue;
int o, t;
- Move move = null;
+ Move move;
for (o = 0; o < 64; o++) {
t=0;
@@ -184,16 +184,16 @@
*/
public boolean doBestMove(int search_depth) {
int value;
-
desired_depth = -1;
bestMove = null;
+
value = max_alpha_beta(search_depth, Integer.MIN_VALUE, Integer.MAX_VALUE);
if ( bestMove == null ) {
System.err.println("Computing once more...");
- value = max_alpha_beta(1, Integer.MIN_VALUE, Integer.MAX_VALUE);
+ value = max_alpha_beta(--search_depth, Integer.MIN_VALUE, Integer.MAX_VALUE);
if (bestMove == null) {
- System.out.println("Check Mate");
+ System.out.println("Check Mate " + value);
return false;
}
}