diff options
| author | Aargh Rai <aargh.rai+git@gmail.com> | 2026-08-15 15:15:21 +0530 |
|---|---|---|
| committer | Aargh Rai <aargh.rai+git@gmail.com> | 2026-08-15 15:15:21 +0530 |
| commit | 54afeb6dd89fffae92274cb6fe2e9a86fd57c6e3 (patch) | |
| tree | 0d6aa206f28c9b00f785d0981bb77a97851f1ce4 /include/engine | |
| parent | f97ea63ac29c08530b1aaff89277262b44ef7a11 (diff) | |
phase B
Diffstat (limited to 'include/engine')
| -rw-r--r-- | include/engine/evaluate.h | 10 | ||||
| -rw-r--r-- | include/engine/search.h | 36 |
2 files changed, 46 insertions, 0 deletions
diff --git a/include/engine/evaluate.h b/include/engine/evaluate.h new file mode 100644 index 0000000..ecc6e60 --- /dev/null +++ b/include/engine/evaluate.h @@ -0,0 +1,10 @@ +#ifndef EVALUATE_H +#define EVALUATE_H + +#include "bitboard.h" + +// static evaluation from the side-to-move's point of view. +// positive == good for the side to move, negative == good for the opponent. +i32 evaluate(position_t position); + +#endif // EVALUATE_H diff --git a/include/engine/search.h b/include/engine/search.h new file mode 100644 index 0000000..94b5da5 --- /dev/null +++ b/include/engine/search.h @@ -0,0 +1,36 @@ +#ifndef SEARCH_H +#define SEARCH_H + +#include <stdatomic.h> + +#include "bitboard.h" +#include "engine/moves.h" +#include "engine/ttable.h" +#include "ipc/go_args.h" + +#define SEARCH_MATE 30000 +#define SEARCH_INF 32000 + +typedef struct { + i32 score; + move_t best_move; +} search_result_t; + +// shared per-search context. `stop` is signalled by the UCI thread (SIGSTOP), +// `go_args` carries the time/node/depth limits, `nodes` counts visited nodes. +typedef struct { + ttable_t *ttable; + go_args_t *go_args; + atomic_bool *stop; + u64 *nodes; +} search_ctx_t; + +search_result_t search( + position_t position, + int depth, + int alpha, + int beta, + search_ctx_t *ctx +); + +#endif // SEARCH_H |
