Plates are now Spinning

Yesterday, at long last, I put my AI into its own separate thread. It all went very smoothly, but then again I’d been thinking for a while before I started typing. Typing is never the hard part.

So now, not only does the program not lock up while the AI is thinking, but I can do some other tricks as well. I’ve already got it so that it works to schedule, spending a set amount of time on each turn (unless it quickly finds a solution it’s really confident about). This means that going into situations with fewer possible moves per turn, it automatically looks ahead farther rather than just deciding faster. In the future, it’d be easy to have a setting for how long the AI takes thinking, so you can adjust it to your level of patience and desired AI cleverness.

In the short term, though, it does mean that bugs just became a lot harder to reproduce, because the AI’s behavior is not particularly deterministic. If it happens to finish a given search depth within the time limit one game but not another, it’s potentially going to return different results. Working around that may call for an actual recording and playback system; we’ll see.

For now, though, it’s as good a point as any to start testing and packaging up a new release. Maybe tomorrow: watch this space.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.