Skip to content

Feature/time based search#32

Merged
boraaros merged 5 commits into
mainfrom
feature/time-based-search
Mar 29, 2026
Merged

Feature/time based search#32
boraaros merged 5 commits into
mainfrom
feature/time-based-search

Conversation

@boraaros

Copy link
Copy Markdown
Owner

No description provided.

- IConfiguration: add optional TimeBudget property (default null)

- ISearchManager/SearchManager: add IsAborted flag, StartTimedSearch(), CheckTimeBudget() with batched Stopwatch check every 1024 nodes

- AlphaBetaPruning: abort check at top of SearchRecursively, guard TT writes when aborted to prevent cache poisoning

- AlphaBetaSolver: add timeBudgetMs parameter (default 0), abort handling in iterative deepening loop and BestNodeSearch, discard aborted iteration results

- SolverProvider: pass TimeBudget to solver

- ConnectFour Configuration: MaxDepth=43, TimeBudget=5s
MaxSearchDepth was 16 but MaxDepth=43 allows searches up to depth 42, causing orderedStepBuffers[depth] to go out of bounds at depth 16+.
Terminal values used remaining depth (sbyte.MaxValue + depth), which varied with DepthLimit — the same forced win scored higher at deeper iterations, causing +2 value drift per iteration and suboptimal MTD(f) guess propagation.

Now uses distanceFromRoot: WinValue = sbyte.MaxValue + MaxSearchDepth - distanceFromRoot, making the same game outcome produce identical values regardless of search depth. Updated BestNodeSearch bounds to match new WinValue range (±175).
@boraaros boraaros merged commit 4b8d8f8 into main Mar 29, 2026
1 check passed
@boraaros boraaros deleted the feature/time-based-search branch March 29, 2026 22:14
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.

1 participant