Skip to content
Permalink
eee037ff22
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
34 lines (27 sloc) 670 Bytes
public class EndEvaluator extends LearningEvaluator {
public EndEvaluator(String file) {
super(file);
}
public double evaluate(CheckersGameState s, int player) {
double endVal = 100;
if(s.isTerminal()){
if(s.winner() == player){
return endVal;
}
else if(s.winner() == 0){
return 0;
}
else {
return -endVal;
}
}
double[] params = s.getFeatures(player);
double value = dot(this.weights, params);
if(value > endVal) {
value = endVal - 1;
} else if(value < -endVal) {
value = -endVal + 1;
}
return value;
}
}