DroidFish: Moved the "strength" variable from UCIEngine to DroidComputerPlayer.

This commit is contained in:
Peter Osterlund 2011-12-28 13:20:04 +00:00
parent 1e2d42a9e0
commit 519f104f0f
5 changed files with 6 additions and 15 deletions

View File

@ -51,6 +51,7 @@ public class DroidComputerPlayer {
/** >1 if multiPV mode is supported. */
private int maxPV = 1;
private int numCPUs = 1;
private int strength = 1000;
private boolean havePonderHit = false;
@ -71,6 +72,7 @@ public class DroidComputerPlayer {
this.engine = engine;
startEngine();
}
this.strength = strength;
if (uciEngine != null)
uciEngine.setStrength(strength);
}
@ -105,10 +107,10 @@ public class DroidComputerPlayer {
/** Get engine reported name, including strength setting. */
public synchronized String getEngineName() {
if (uciEngine != null)
return engineName + uciEngine.addStrengthToName();
else
return engineName;
String ret = engineName;
if (strength < 1000)
ret += String.format(" (%.1f%%)", strength * 0.1);
return ret;
}
/** Clear transposition table. */

View File

@ -25,7 +25,6 @@ public class NativePipedProcess extends UCIEngineBase {
@Override
public void setStrength(int strength) {
this.strength = strength;
setOption("Skill Level", strength/50);
}

View File

@ -41,9 +41,6 @@ public interface UCIEngine {
/** Set the engine strength, allowed values 0 - 1000. */
public void setStrength(int strength);
/** Add strength information to the engine name. */
public String addStrengthToName();
/** Set an engine integer option. */
public void setOption(String name, int value);

View File

@ -5,7 +5,6 @@ import java.util.HashMap;
public abstract class UCIEngineBase implements UCIEngine {
private boolean processAlive;
protected int strength = 1000;
protected UCIEngineBase() {
processAlive = false;
@ -29,11 +28,6 @@ public abstract class UCIEngineBase implements UCIEngine {
}
}
@Override
public String addStrengthToName() {
return strength < 1000 ? String.format(" (%.1f%%)", strength * 0.1) : "";
}
@Override
public void setOption(String name, int value) {
setOption(name, String.format("%d", value));

View File

@ -68,7 +68,6 @@ public class CuckooChessEngine extends UCIEngineBase {
@Override
public void setStrength(int strength) {
this.strength = strength;
setOption("strength", strength);
}