#pragma once

#include "board.h"
#include "hash.h"

typedef struct {
    Move moves[256];
    int len;
    int pair_count;
} Solution;

typedef struct {
    Move *moves;
    int count;
} MoveList;

/* Build move list for given size and n_limit. Caller frees moves. */
int build_move_list(int size, int n_limit, MoveList *out);
void free_move_list(MoveList *ml);

/* Beam search with transposition table. Returns 0 on success. */
int solve_beam(const Board *start,
               int beam_width,
               int max_depth,
               int n_limit,
               int stagnation_limit,
               uint64_t hash_capacity,
               Solution *out);
