#ifndef SEARCH_H_INCLUDED
#define SEARCH_H_INCLUDED

#include "ramjet.h"
#include "eval.h"
#include "hash.h"
#include "history.h"
#include "game.h"
#include "pv.h"
#include "options.h"
#include "params.h"
#include "stats.h"

// the search data type
typedef struct {
    OPTIONS opt;
    PARAMS par;
    STATS stat;
    GAME gm;
    PV pv;
    HASHTABLE ht;
    HISTORYTABLE hy;
} SEARCH;

// messages to the GUI
typedef enum {MT_DEPTH, MT_SPEED, MT_CURRMV, MT_PV, MT_BEST} MSGTYPE;
#define MT_MAX 1024

// send a message to the GUI
void src_print_uci(const SEARCH* src, MSGTYPE mt);

// decide when to stop searching
int src_halt(SEARCH* src, int root);

// quiescence search
EVAL src_quiesc(SEARCH* src, int ply, int depth, EVAL alpha, EVAL beta);

// main search routine
EVAL src_negamax(SEARCH* src, int ply, int depth, EVAL alpha, EVAL beta);

// root search routine, pass SEARCH* as argument
void src_root(void* arg);

#endif // SEARCH_H_INCLUDED
