Skip to content

Commit

Permalink
improve typing exp
Browse files Browse the repository at this point in the history
  • Loading branch information
JieningYu committed Dec 27, 2022
1 parent 151d312 commit 648fe50
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ fn main() {
loop {
let input = input_string();
if input == "exit" || input == "quit" {
break;
process::exit(1);
}
if input == "super" {
super_mode = !super_mode;
Expand All @@ -41,20 +41,27 @@ fn main() {
.split_whitespace()
.map(|s| s.parse().unwrap())
.collect();

let mut jump = false;
let msg = "Invalid input, please enter 4 numbers between 1 and 13";
for i in numbers.iter() {
if *i < 1 || *i > 13 {
println!("{}", msg);
process::exit(1);
jump = true;
}
}
if numbers.len() != 4 {
println!("{}", msg);
process::exit(1);
jump = true;
}
if input == "" {
jump = true;
}
if jump {
continue;
}

numbers.sort();

let start = Instant::now();
let solutions = solve(&numbers, &super_mode, &max);
if solutions.len() == 0 {
Expand Down
Empty file added src/solver.rs
Empty file.

0 comments on commit 648fe50

Please sign in to comment.