From 1e7f4278484e6bbe92676f9b82462809874849a6 Mon Sep 17 00:00:00 2001 From: Gnarwhal Date: Fri, 26 Jul 2019 00:31:07 -0700 Subject: [PATCH] Completed the help menu --- src/main.rs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 2f546ba..92183f6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -62,7 +62,8 @@ is enter the \"help\" command and I'll be there to assist you. I say assist you a favor. Really I just explain the limited ways in which you can interact with me given my simplistic intelligence. I won't always understand you, but I try my best. -So! Without further ado let's get this show on the road!"); +So! Without further ado let's get this show on the road! +"); let mut singleplayer = true; let mut depth: u32 = 4; @@ -76,7 +77,7 @@ So! Without further ado let's get this show on the road!"); let action = get_action(); match action { Action::Example => println!("You would like an example"), - Action::Help => println!("You would like help"), + Action::Help => print_help(), Action::Begin => println!("You would like to begin"), Action::Set(string) => match get_values(&string) { Ok(("singleplayer", value)) => { @@ -138,6 +139,18 @@ fn starts_with(string: &str, begin: &str) -> bool { true } +fn print_help() { + println!("Currently I have a number of commands at my disposal. I'll go ahead and list them for you real quick. + +example > Runs you through an example game if still feel a little unclear on the rules of the game +help > Well I think you already know about this command :) +begin > Begins the epic journey through the binary tree +set {{key}} = {{value}} > Sets some paramaters for the game. Currently the available paramaters are: + singleplayer - a boolean value which switches between playing against me and playing against your mates + depth - an integer value which sets the depth of the tree +quit > I should think you would know what this one does as well"); +} + fn get_values(string: &str) -> Result<(&str, &str), ()> { let mut split = 0; for (i, byte) in string.bytes().enumerate() {