how can I limit the execution time of my iterate-deepening search without using a thread?
Currently I use this simple implementation, but it is not efficient and sometimes even does not terminate within the given timeframe..
timer.Start();
best = doSearch();
timer.Stop();
dpuble time = timer.Duration;
while (time*1000 < 400)
{
timer.Start();
best = doSearch();
timer.Stop();
time += timer.Duration;
}
If you want to avoid threading, you would need to pass a timestamp into your
doSearch()method. It could (periodically) check the current time, and if the duration is past some threshold, raise an exception or return the failed case.