1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//!
//! # Examples
//!
//!
//!```
//!#[macro_use]
//!extern crate log;
//!
//!extern crate env_logger;
//!
//!use uciengine::uciengine::*;
//!
//!#[tokio::main]
//!async fn main() -> Result<(), Box<dyn std::error::Error>> {
//!	env_logger::init();
//!	
//!	info!("starting up");
//!	
//!	let go_job1 = GoJob::new()				
//!		.uci_opt("UCI_Variant", "atomic")
//!		.uci_opt("Hash", 128)
//!		.uci_opt("Threads", 4)
//!		.pos_fen("k7/8/8/8/8/8/R7/7K w - - 0 1")
//!		.pos_moves("h1h2")
//!		.tc(Timecontrol{
//!			wtime: 15000,
//!			winc: 0,
//!			btime: 15000,
//!			binc: 0
//!		})
//!	;
//!	
//!	let go_job2 = GoJob::new()			
//!		.uci_opt("UCI_Variant", "chess")
//!		.pos_startpos()
//!		.go_opt("depth", 12)
//!	;
//!			
//!	let engine = UciEngine::new("./stockfish12");
//!	
//!	let ( engine_clone1 , engine_clone2 ) = ( engine.clone(), engine.clone() );
//!	
//!	tokio::spawn(async move {	
//!		let engine = engine_clone1;
//!	
//!		let go_result = engine.go(go_job1).recv().await;
//!
//!		println!("go result 1 {:?}", go_result);
//!	});
//!	
//!	tokio::spawn(async move {		
//!		let engine = engine_clone2;
//!	
//!		let go_result = engine.go(go_job2).recv().await;
//!
//!		println!("go result 2 {:?}", go_result);
//!		
//!		engine.quit();
//!	});
//!	
//!	tokio::time::sleep(tokio::time::Duration::from_millis(20000)).await;
//!		
//!	Ok(())
//!}
//!```


// lib
pub mod uciengine;