From 15f64980573085e9ab6a9d47fc2a6e8092d6d109 Mon Sep 17 00:00:00 2001 From: tslil clingman <> Date: Mon, 10 Feb 2020 17:36:50 -0800 Subject: Feature completion for 0.2.0 --- src/main.rs | 53 ++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 38 insertions(+), 15 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 50bfcf4..31414b8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,6 +6,7 @@ mod game; mod gui; mod parser; +use crate::consulter::consulter_clean_up; use crate::game::*; use crate::gui::*; use crate::parser::parse_start_type; @@ -28,45 +29,59 @@ fn main() { { let mut ap = ArgumentParser::new(); - ap.set_description("Test description."); + ap.set_description( + "A TUI + implementation of and wrapper for engines for the game of + Tak.", + ); ap.refer(&mut p1_name).add_option( &["--player1"], Store, - "Name of first player, defaults to $USER. See --name-white below for Black/White assignment.", + "Name of first player, defaults to $USER. See --name-white + below for Black/White assignment.", ); ap.refer(&mut p2_name).add_option( &["--player2"], Store, "Name of second player, defaults to ``Player2'' and is - overridden by the arument ENGINE of --engine when applicable.", + overridden by the arument ENGINE of --engine when + applicable.", ); ap.refer(&mut start_type_string) .add_option( &["-v", "--variant-start"], Store, - "Select the rule variant for the start of play. Valid choices are CPSn, FCS, FES, TPS, and CZS. - The default starting type, which matches the original rules, is CPS1.", + "Select the rule variant for + the start of play. Valid choices are CPSn, FCS, FES, TPS, + and CZS. The default starting type, which matches the + original rules, is CPS1. See ENGINE below for a warning on + this.", ) .metavar("VRNT"); ap.refer(&mut engine).add_option( &["-e", "--engine"], Store, - "Name of process which will be used as a computer opponent. - The process must accept a single argument point to a PTN file - of the current game state, and must generate a single PTN action - on STDOUT. The engine will replace the second player, and the name - of player 2 is set to this argument.", + "Name of process which will be used as a computer + opponent. The process must accept a single argument point + to a PTN file of the current game state, and must generate + a single PTN action on STDOUT. The engine will replace the + second player, and the name of player 2 is set to this + argument. Note: ensure that your engine understands the + [Variant XXX] directive if you choose a variant (above).", ); - ap.refer(&mut name).add_option( - &["--name-white"], - Store, - "Force the player named NAME to play white. If not supplied, assignment is ``random''.", - ).metavar("NAME"); + ap.refer(&mut name) + .add_option( + &["--name-white"], + Store, + "Force the player named NAME to play white. If not + supplied, assignment is ``random''.", + ) + .metavar("NAME"); ap.refer(&mut size).add_option( &["-s", "--size"], @@ -136,6 +151,14 @@ fn main() { } } + // Clean up file + if call_proc { + if let Err(e) = consulter_clean_up() { + gui.message_log + .log_error(format!("Error in cleaning up temporary files: {}", e)); + } + } + // board_gui.read_action(); endwin(); } -- cgit v1.3.1