#mongo-db #chess #opening #book

bin+lib mongobook

Mongodb hosted chess opening book. Under construction.

15 releases

0.1.14 Jan 9, 2021
0.1.13 Jan 9, 2021

#16 in #opening

28 downloads per month

MIT and GPL-3.0+

22KB
422 lines

mongobook

documentation Crates.io Crates.io (recent)

Mongodb hosted chess opening book. Under construction.

Usage

extern crate env_logger;

use dotenv::dotenv;

use mongobook::mongobook::*;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>>{
	dotenv().ok();
	env_logger::init();
	
	println!("mongobook, under construction");

	let mut mongobook = MongoBook::new().book_depth(10);

	mongobook.connect().await;

	println!("{}", mongobook);

	let pgn = std::fs::read_to_string("test.pgn").unwrap();

	//mongobook.drop_coll("pgns").await;
	//mongobook.drop_coll("moves").await;

	mongobook.add_pgn_to_book(pgn).await;

	let start_epd = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq -";

	println!("{:?}", mongobook.get_moves("standard", start_epd).await);
	
	Ok(())
}

Logging

export RUST_LOG=info
# or 
export RUST_LOG=debug

Dependencies

~34–49MB
~1M SLoC