#ifndef HISTORY_H_INCLUDED
#define HISTORY_H_INCLUDED

#include <stdint.h>
#include "move.h"
#include "position.h"

// the history entry data type
typedef uint16_t HISTORYENTRY;
#define HE_NULL 0
#define HE_MAX UINT16_MAX
#define HE_INC(depth) ((depth) * (depth))

// the history table data type
typedef struct {
    HISTORYENTRY entry[2][6][64];
} HISTORYTABLE;

// set all counters to zero
void history_clear(HISTORYTABLE* hy);

// divide all the counters by two
void history_halve(HISTORYTABLE* hy);

// update the history counters
void history_update(HISTORYTABLE* hy, POSITION* pos, MOVE mv, int depth);

#endif // HISTORY_H_INCLUDED
