1 个不稳定版本
0.2.0 | 2023 年 12 月 6 日 |
---|---|
0.1.0 |
|
#2473 在 命令行工具
16KB
381 行
sort_solves
sort_solves 是一个二进制文件,它接受魔方解法的 json 文件并生成一个新的排序后的 json 文件。
$ sort_solves best ao5 ./solves.json ./sorted-solves.json
solves.json 示例
[{"time":12.093625067611864,"comment":"","scramble":"LRLRLRLRLRRLRL",
"id":"13ced05e-612b-4eb0-a55e-1e551f5f6093",
"created_at":"2023-12-06T07:04:04.464338841Z","plus_two":false,"dnf":false}]
rust 解法类型(需要 chrono::serde 功能来自动序列化和反序列化日期)
use serde::{Deserialize, Serialize};
use chrono::{DateTime, Utc};
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Solve {
pub time: f64,
pub comment: String,
pub scramble: String,
pub id: String,
pub created_at: DateTime<Utc>,
pub plus_two: bool,
pub dnf: bool,
}
sorted-solves.json 示例
[{"last_solve":{"time":9.465833877444984,"comment":"",
"scramble":"LRLRLRLRLRRLRL","id":"f9c2b326-0f64-4964-9616-4557656ac331",
"created_at":"2023-12-06T07:04:04.464219529Z","plus_two":false,"dnf":false},
"time":9.93495505183404,"none":false,"dnf":false}]
rust 排序列法类型(其中 Solve 是之前显示的)
use serde::Serialize;
#[derive(Serialize, Debug, Clone)]
pub struct Ao5Solve {
pub last_solve: Solve,
pub time: f64,
pub none: bool,
pub dnf: bool,
}
本项目采用 MIT 许可证
依赖项
~3–4MB
~77K SLoC