~alip/jja

d4c5131eb408e5979dc581f5bad7b79ca6aa20bf — Ali Polatel 11 months ago 10a3979
restore: lichess eval export -> brainlearn (take 2)
1 files changed, 40 insertions(+), 0 deletions(-)

A src/lieval.rs
A src/lieval.rs => src/lieval.rs +40 -0
@@ 0,0 1,40 @@
//
// jja: swiss army knife for chess file formats
// src/lieval.rs: Lichess evaluations export file constants and utilities
//
// Copyright (c) 2023 Ali Polatel <alip@chesswob.org>
//
// SPDX-License-Identifier: GPL-3.0-or-later

use serde::{Deserialize, Serialize};

/// Lichess Evaluations
#[derive(Serialize, Deserialize, Debug)]
pub struct LichessEval {
    /// FEN
    pub fen: String,
    /// List of evaluations
    pub evals: Vec<Eval>,
}

/// Lichess Evaluation
#[derive(Serialize, Deserialize, Debug)]
pub struct Eval {
    /// List of principled variations
    pub pvs: Vec<Pv>,
    /// Depth in kilo nodes
    pub knodes: u64,
    /// Depth in ply
    pub depth: i32,
}

/// Lichess Principled Variation
#[derive(Serialize, Deserialize, Debug)]
pub struct Pv {
    /// Score in centipawns
    pub cp: Option<i32>,
    /// Mate in number of plies
    pub mate: Option<i32>,
    /// Moves as space separated UCI
    pub line: String,
}