Skip to content
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

Automatically add multiple selected engines at once #708

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alwey
Copy link
Contributor

@alwey alwey commented Jan 23, 2022

This PR provides a speedy method for automatically adding new engines to the list of engine configurations of the GUI.
The user presses the new "auto add"-button and selects a set of engine binaries from a working directory. After clicking "OK" all selected engines are tested against all supported protocols. On success the configuration is added to the list of installed engines.

Only engines with at least one option are added. Engines without options must be added in the traditional way.

Name collisions are avoided automatically by appending the protocol name (and a number if necessary).

aa9

Technically, to accomplish this a new "auto add"-button to EngineManagementWidget is used to invoke the new
method EngineManagementWidge::addEngines. This method provides a file dialog which lets the user select multiple eingine executables. After the user confirmed his selectionon a list is genetrated. Each entry is the combination of target file name and protocol (currently UCI and xboard). After the list is complete a timer is started.

The timer regularly calls the method EngineManagementWidget:::onDetectionTimer, which uses the first entry of the list to set arguments for invoking EngineManagementWidget::detectEngine. Thie first entry is then removed from the list. When the list is empty the timer is stopped .

EngineManagementWidget::detectEngineuses a hidden EngineConfigurationDialog for work. A list of reserved names which contains all existing configuration names is set up to prevent name collisions. Then the method probe(file, proto) of EngineConfigurationDialog is used to start the engine detection.

The method EngineConfigurationDialog::probe contains some statements to avoid name collisions. It then calls the method
EngineConfigurationDialog::detectEngineOptions.

When the EngineConfigurationDialog::finished signal is emitted the connected lambda defined in EngineManagementWidget::detectEngine adds the detected engine configuration to the list of installed engines. The hiddenEngineConfigurationDialog is closed immediately after that.

The auto detection uses much of the methods already used in the existing manual configuration. It only adds the
method probe and signal hasError() to EngineConfigurationDialog.
The implementation avoids showing warnings by QMessageBox when auto probing.

Resolves #687
Resolves #669

HTH

aa1
A new "auto add"-button (first on the left) " is pressed. The engine list is empty in this example.

aa2
Here a whole collection of stockfish binaries is selected.
The selection is confirmed with "OK". The selection can be facilitated, e.g. on Linux by using the SHIFT and the CTRL-Buttons.

aa3
After about 10 seconds, several entries have been added to the list of installed engine configurations.

aa4
After 15 seconds the list is complete. The detection still runs for about 30 seconds but is working on xboard detection without further success.

aa5
The user has to avoid selecting binaries that are not chess engines.
Those would be started, clobber the screen and use CPU time.

aa6
Three engines that support both UCI and xboard protocol. Name collisions are resolved automatically by adding the protocol and a counter. A second level check resolves occasional name collisions - for concurrent configurations that entered the detection stage with the same name. The protocol name and a random hex value is appended (here for arasanx-64-popcount ) .

aa7
Repeat detection with the same engines. Name collisions are avoided again.

Add an "auto add"-button to EngineManagementWidget.
Add methods addEngines, onDetectionTimer, and detectEngine to
EngineManagementWidget.
Add method probe and signal hasError() to EngineConfigurationDialog.
Avoid showing warnings by QMessageBox when auto probing.

Resolves cutechess#687
Resolves cutechess#669
@alwey alwey changed the title Automatically add selected engines at once Automatically add multiple selected engines at once Feb 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Configure multiple engines at once Quicker engine configuration
1 participant