MAINT: Apply 'pre-commit run --all' and fix issues

This commit is contained in:
Martin Thoma
2022-03-10 06:59:21 +01:00
parent ddacedb0b0
commit e7520d62af
22 changed files with 200 additions and 231 deletions

View File

@@ -6,4 +6,4 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
rand = "0.8.5"
rand = "0.8.5"

View File

@@ -1,3 +1,3 @@
Original source downloaded [from Vintage Basic](http://www.vintage-basic.net/games.html)
Conversion to [Rust](https://www.rust-lang.org/) by Anthony Rubick [AnthonyMichaelTDM](https://github.com/AnthonyMichaelTDM)
Conversion to [Rust](https://www.rust-lang.org/) by Anthony Rubick [AnthonyMichaelTDM](https://github.com/AnthonyMichaelTDM)

View File

@@ -25,15 +25,15 @@ fn main() {
/*
vector of:
vectors of:
integers
Initially set to 0, unprocessed cells.
integers
Initially set to 0, unprocessed cells.
Filled in with consecutive non-zero numbers as cells are processed
*/
let mut used; //2d vector
/*
vector of:
vectors of:
integers
integers
Remains 0 if there is no exit down or right
Set to 1 if there is an exit down
Set to 2 if there is an exit right
@@ -43,11 +43,11 @@ fn main() {
let width;
let height;
let entrance_column; //rng, column of entrance
let mut row;
let mut row;
let mut col;
let mut count;
//print welcome message
println!("
@@ -171,13 +171,13 @@ fn main() {
fn get_user_input(prompt: &str) -> usize {
//DATA
let mut raw_input = String::new(); // temporary variable for user input that can be parsed later
//input loop
return loop {
//print prompt
println!("{}", prompt);
//read user input from standard input, and store it to raw_input
raw_input.clear(); //clear input
io::stdin().read_line(&mut raw_input).expect( "CANNOT READ INPUT!");
@@ -186,7 +186,7 @@ fn get_user_input(prompt: &str) -> usize {
match raw_input.trim().parse::<usize>() {
Ok(i) => {
if i>1 { //min size 1
break i; // this escapes the loop, returning i
break i; // this escapes the loop, returning i
}
else {
println!("INPUT OUT OF RANGE. TRY AGAIN.");