Add empty_position()

This commit is contained in:
Martin HART 2020-10-20 16:57:51 +02:00
parent 569a6eaf94
commit 67c292b9e2

View File

@ -24,6 +24,10 @@ impl World {
Orientation::W => '←',
}
}
/// Check if a position is free.
fn empty_position(&mut self, p: Position) -> bool {
self.map[(p.x * p.y) as usize] == '.'
}
}
/// Struct to store robot position.