Add "SearchDepth" UCI option #21
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Leaving this here for now. It works, though I'm not totally happy with it.
This pull request adds a UCI option
SearchDepthwhich controls the depth at which the engine will search. This allows you to set the depth of the engine using the menu of a UCI compatible chess engine. I tested it with Cute Chess and it works as intended. Also, the command line option--depthstill works as normal.Here is what I don't like:
I converted the variable
depthinto a global variable so it persists over time and can be modified when asetoptioncommand comes in. What I wanted to do is removedepthas a parameter from thecommandfunction, and just have it read that global variable instead. But python isn't my strongest language, and I can't quite figure out how to get the unit testing suite to be able to set or read that variable. I tried importing it, I tried just declaring it as a global and seeing if it would match it with the global from the other file, but I couldn't quite figure it out. So, maybe you know what I've done wrong here.So instead, I just kept
depthas a parameter, and made a newsearch_depthglobal variable.setoptionmodifies that global variable rather than the local one.I wanted to write a test case that checked that the
setoptioncommand works as intended, but again, I couldn't figure out how to get the testing file to properly read the value! I wrote the following test:I believe the above test should work, but it says that the assertion failed because 3 != 5. I checked running the command manually in UCI mode, and that command definitely is working as intended. Maybe you know why this test isn't working :P
I don't think this PR should be merged as-is. If you can help me understand python better and get that global variable to be readable/writeable from both files, then we can remove the redundant parameter from
commandand just have it read the global while also adding in the new test.Let me know your thoughts! :)