Implement basic frontend-engine interaction

Use a Flask-based Python server as an adapter to the engine's
stdin-stdout inferface.
This commit is contained in:
2021-12-11 14:58:16 +01:00
parent 57931b29de
commit b5c252bd4d
4 changed files with 80 additions and 38 deletions

View File

@@ -1,7 +1,19 @@
use std::io::BufRead;
mod board;
mod ui;
fn main() {
let board = board::Board::new();
println!("{}", board.to_string());
fn main() -> Result<(), ()> {
let mut board = board::Board::new();
board.reset();
let stdin = std::io::stdin();
let mut input_lines = stdin.lock().lines();
loop {
match input_lines.next() {
None => break Ok(()),
Some(line) => match &line.unwrap()[..] {
"get_state" => println!("{}", board.to_string()),
_ => break Err(()),
},
}
}
}