improve names
This commit is contained in:
parent
e4bd2597d5
commit
023923f06b
10
src/main.rs
10
src/main.rs
@ -58,7 +58,7 @@ mod rover {
|
||||
mod driver {
|
||||
use super::rover;
|
||||
|
||||
fn perform_insn(command: &str, rover: &rover::Rover) -> rover::Rover {
|
||||
fn perform_command(command: &str, rover: &rover::Rover) -> rover::Rover {
|
||||
match command {
|
||||
"f" => rover::forward(&rover),
|
||||
"b" => rover::backward(&rover),
|
||||
@ -68,12 +68,12 @@ mod driver {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn execute(rover: &rover::Rover, instructions: &str) -> rover::Rover {
|
||||
if instructions.is_empty() {
|
||||
pub fn execute(rover: &rover::Rover, commands: &str) -> rover::Rover {
|
||||
if commands.is_empty() {
|
||||
rover.clone()
|
||||
} else {
|
||||
let (first, rest) = instructions.split_at(1);
|
||||
execute(&perform_insn(first, rover), rest)
|
||||
let (now, later) = commands.split_at(1);
|
||||
execute(&perform_command(now, rover), later)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user