mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2025-02-17 09:37:50 +01:00
DroidFish: Moved the "strength" variable from UCIEngine to DroidComputerPlayer.
This commit is contained in:
parent
1e2d42a9e0
commit
519f104f0f
|
@ -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. */
|
||||
|
|
|
@ -25,7 +25,6 @@ public class NativePipedProcess extends UCIEngineBase {
|
|||
|
||||
@Override
|
||||
public void setStrength(int strength) {
|
||||
this.strength = strength;
|
||||
setOption("Skill Level", strength/50);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -68,7 +68,6 @@ public class CuckooChessEngine extends UCIEngineBase {
|
|||
|
||||
@Override
|
||||
public void setStrength(int strength) {
|
||||
this.strength = strength;
|
||||
setOption("strength", strength);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user