-
Notifications
You must be signed in to change notification settings - Fork 228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
next: Support Switch Multiple Engine Heights #368
Conversation
return ""; | ||
} | ||
int width = fm.stringWidth(line); | ||
if (width > fitWidth) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double space before >
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
@@ -80,4 +81,36 @@ public static void saveAsFile(URL url, File file) { | |||
e.printStackTrace(); | |||
} | |||
} | |||
|
|||
/** | |||
* Fit the too long text by width |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fit doesn't sound like the correct word here. Maybe crop
, cut
or truncate
?
/** Truncate text that is too long for the given width */
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed.
// substitute in the weights file | ||
engineCommand = engineCommand.replaceAll("%network-file", config.getString("network-file")); | ||
|
||
// Init current engine no and start engine |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Init current engine number
I would also call the variable differently, currentEngineN
or currentEngineNumber
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed.
|
||
public void startEngine(String engineCommand) throws IOException { | ||
// Check engine command | ||
if (engineCommand == null || "".equals(engineCommand.trim())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
engineCommand.trim().isEmpty()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed.
} | ||
} | ||
// Go to move number by back routing when in branch | ||
public boolean goToMoveNumberByBack(int moveNumber) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this a separate method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also the return value is never used, meaning the method can be refactored as follows:
int delta = moveNumber - history.getMoveNumber();
for (int i = 0; i < Math.abs(delta); i++) {
BoardHistoryNode curNode = history.getCurrentHistoryNode();
if (curNode.numberOfChildren() > 1 && delta > 0) {
nextMove(curNode.getFromBackChildren());
} else {
if (!(delta > 0 ? nextMove() : previousMove())) {
return;
}
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function goToMoveNumberByBack process the move by saved the children branch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Return value removed.
} | ||
} | ||
// Save the move number | ||
public BoardHistoryNode saveMoveNumber() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The returned value is never used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
@@ -433,6 +435,79 @@ public boolean nextMove() { | |||
} | |||
} | |||
|
|||
/** | |||
* Goes to the next coordinate, thread safe |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation doesn't explain the meaning of the returned boolean.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed.
saveNode = curNode; | ||
return curNode; | ||
} | ||
// Save the back routing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, I would avoid comments that paraphrase method name: they don't add any information to what the code already says.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed.
node.previous().setFromBackChildren(node.previous().getNexts().indexOf(node)); | ||
saveBackRouting(node.previous()); | ||
} | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Useless return
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
@OlivierBlanvillain |
@@ -80,4 +81,37 @@ public static void saveAsFile(URL url, File file) { | |||
e.printStackTrace(); | |||
} | |||
} | |||
|
|||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
Needs a rebased, LGTM otherwise! |
I took care of the conflicts, let's get this in 🎉 |
Closes: #356
Support to switching multiple engine heights. (Currently only support Leela Zero Engine)
How to config:
"engine-command": "./leelaz --gtp --lagbuffer 0 --weights %network-file --threads 2",
"engine-command-list": [
"./leelaz --gtp --lagbuffer 0 --weights leelaz_172_b1c --threads 2",
"./leelaz --gtp --lagbuffer 0 --weights human_best --threads 2",
"./leelaz --gtp --lagbuffer 0 --weights elf_1_62b --threads 2",
"./leelaz --gtp --lagbuffer 0 --weights leelaz_157_d35 --threads 2"
],
Ctrl+0: Default switch to "engine-command"
Ctrl+(1-9): Switch to "engine-command-list"
Demo:
![image](https://user-images.githubusercontent.com/42595514/45369539-bd86d280-b618-11e8-8749-2c1a021707dc.png)
![image](https://user-images.githubusercontent.com/42595514/45369606-e0b18200-b618-11e8-89d8-7456820d699f.png)