diff --git a/src/CheckersGameState3.java b/src/CheckersGameState3.java index 231871a..a1a293f 100644 --- a/src/CheckersGameState3.java +++ b/src/CheckersGameState3.java @@ -351,12 +351,36 @@ public class CheckersGameState3 implements CheckersGameState{ return mypieces/total; } + /* distance to promotion line */ + public int getDistance(int i){ + int row = (i-(i/9))/4; + if(player == 1) return 7-row; + else return row; + } + + private double promotionLineOpenings(int player){ + double sum =0.0; + if(player == 1){ + for(int i = 31; i<35; i++) { + if(empty(board,i)) sum +=1.0; + } + } + else if(player == 2){ + for(int i = 0; i<4; i++){ + if(empty(board,i)) sum +=1.0; + } + } + return sum; + } + /* computes feature vector: piece-ratio, loners, safes, pawns, - moveable pawns, kings, moveable kings + moveable pawns, aggregate distance, + kings, moveable kings, promotion line + opening */ public double[] getFeatures(int player){ - double[] features = new double[7]; + double[] features = new double[9]; double total = 0.0; double mypieces = 0.0; for(int i = 0; i