#pragma once

#include <stdint.h>

#define MAX_SIZE 24

typedef struct {
    uint8_t x;
    uint8_t y;
    uint8_t n;
} Move;

typedef struct {
    int size; /* even 4..24 */
    uint8_t cells[MAX_SIZE][MAX_SIZE];
    int pair_count;
    uint64_t hash;
} Board;

void board_copy(Board *dst, const Board *src);
int board_compute_pairs(const Board *b);
int board_max_pairs(const Board *b);
uint64_t board_compute_hash(const Board *b);
void board_apply_move(Board *b, const Move *m);

/* Initialize Zobrist table for given size (call once per size change). */
void board_init_zobrist(int size);
