RustySantorini / santorini-engines

1 stars 0 forks source link

Create a public interface for benchmarking #39

Closed PaMeirelles closed 9 months ago

PaMeirelles commented 9 months ago
    pub fn run_test(id_searcher:usize, id_position:usize, depth:usize){
        let func = get_engine(id_searcher);
        let board = sql_helpers::read_position_from_id(id_position).unwrap();
        let flop_board = flop::BoardRepBoard{
            blocks: board.blocks,
            workers: board.workers,
            turn: board.turn,
            moves: vec![],
        };
        let request = SearchRequest{
            position: flop_board,
            max_depth: depth,
            time_left: None,
        };

        let result = func(request);
        let search_results = sql_helpers::SearchResult{
            id_position: id_position,
            vl_depth: depth,
            vl_evaluation: result.eval.unwrap(),
            id_searcher: id_searcher,
            vl_search_duration: result.time_spent.unwrap().as_nanos() as usize,
        };
        sql_helpers::insert_search_result(search_results);
    }

The current one only supports one func from Flop