mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2024-11-27 06:10:28 +01:00
Replace anonymous classes with lambda in CuckooChessEngine
This commit is contained in:
parent
6a90c4e650
commit
708660958c
|
@ -85,11 +85,9 @@ public class ChessController {
|
||||||
buf.append(String.format(Locale.US, "d:%d %d:%s t:%.2f n:%d nps:%d", currDepth,
|
buf.append(String.format(Locale.US, "d:%d %d:%s t:%.2f n:%d nps:%d", currDepth,
|
||||||
currMoveNr, currMove, currTime / 1000.0, currNodes, currNps));
|
currMoveNr, currMove, currTime / 1000.0, currNodes, currNps));
|
||||||
final String newPV = buf.toString();
|
final String newPV = buf.toString();
|
||||||
gui.runOnUIThread(new Runnable() {
|
gui.runOnUIThread(() -> {
|
||||||
public void run() {
|
thinkingPV = newPV;
|
||||||
thinkingPV = newPV;
|
setThinkingPV();
|
||||||
setThinkingPV();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -496,21 +494,17 @@ public class ChessController {
|
||||||
private void startComputerThinking() {
|
private void startComputerThinking() {
|
||||||
if (game.pos.whiteMove != humanIsWhite) {
|
if (game.pos.whiteMove != humanIsWhite) {
|
||||||
if (computerThread == null) {
|
if (computerThread == null) {
|
||||||
Runnable run = new Runnable() {
|
Runnable run = () -> {
|
||||||
public void run() {
|
computerPlayer.timeLimit(gui.timeLimit(), gui.timeLimit(), gui.randomMode());
|
||||||
computerPlayer.timeLimit(gui.timeLimit(), gui.timeLimit(), gui.randomMode());
|
final String cmd = computerPlayer.getCommand(new Position(game.pos),
|
||||||
final String cmd = computerPlayer.getCommand(new Position(game.pos),
|
game.haveDrawOffer(), game.getHistory());
|
||||||
game.haveDrawOffer(), game.getHistory());
|
gui.runOnUIThread(() -> {
|
||||||
gui.runOnUIThread(new Runnable() {
|
game.processString(cmd);
|
||||||
public void run() {
|
thinkingPV = "";
|
||||||
game.processString(cmd);
|
updateGUI();
|
||||||
thinkingPV = "";
|
setSelection();
|
||||||
updateGUI();
|
stopComputerThinking();
|
||||||
setSelection();
|
});
|
||||||
stopComputerThinking();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
if (threadStack > 0) {
|
if (threadStack > 0) {
|
||||||
ThreadGroup tg = new ThreadGroup("searcher");
|
ThreadGroup tg = new ThreadGroup("searcher");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user