Closed brane-games closed 4 months ago
Sure,
Is shown when you call the Position constructor without providing a SearchThread due to a design quirk with Position objects needing an owner. It was just a heads-up to myself when I was working out multithreading (and it fixes itself afterward which is why it runs normally after). I'll remove it since it's no longer a concern.
If you are asking if the same engine instance can play a game and simultaneously do other searches, that won't work. Currently, only one search at a time can take place, so if you send multiple positions to search, the input thread will be blocked and queue them up. Or if you are asking if it will function properly if you use it as a library instead of an executable, I can't think of any reasons why it wouldn't work. So long as you give it the position and any search constraints it should be just fine.
I didn't use any async patterns for the same reason as above. The threading logic does work fine in async, but if another search is started before a previous one finishes it's UB. Calling WaitForThreadFinished on the main search thread will block the caller until the search finishes if you want that, and the accumulator refreshes are done automatically when a new position is created or FEN is loaded. Something like this should work:
public async Task FindNextMove(string fen)
{
await Task.Run(() =>
{
Lizard.Logic.Core.Position pos = new Lizard.Logic.Core.Position(fen);
var info = new SearchInformation(pos, 18);
info.OnDepthFinish = OnDepthDone;
info.OnSearchFinish = OnSearchDone;
SearchThreadPool.SearchPool.StartSearch(info.Position, ref info, _setup);
//SearchThreadPool.SearchPool.MainThread.WaitForThreadFinished();
});
}
Let me know if there are any problems so I can look into them :)
That's great! Looking forward to making the switch in upcoming months.
Thank you!
Hey Liam!
I'm a developer of a chess career simulation game called Master of Chess: https://store.steampowered.com/app/2248900/Master_of_Chess/
I'm currently using Caissa engine and UCI protocol to power the AI and analysis tools in my chess game. Because this requires another process I occasionally get crashes. This motivates me to find another engine that I could run in the same process.
I've been playing around with Lizard today and have couple of questions: 1.
WARN Position('rnbqk2r/pppp1ppp/4pn2/8/2PP4/P1P5/4PPPP/R1BQKBNR b KQkq - 0 5', True, ...) has ResetNN true and was given a nullptr for owner! (if ResetNN is true, an owner must be provided)
I get this error when trying to analyze a position. Everything works nicely after it. What does this mean and should I be worried?
Is this code snippet optimal for searching through a position?
Thanks a lot for the great work at making a dotnet powered engine so good!