fix iteration bug
This commit is contained in:
parent
afd8b1dc8b
commit
a470e883af
@ -218,9 +218,9 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
let mut hash: HashMap<robot::Position, u32> = HashMap::new();
|
let mut hash: HashMap<robot::Position, u32> = HashMap::new();
|
||||||
create_hash_map(&robot_pool, &mut hash);
|
create_hash_map(&robot_pool, &mut hash);
|
||||||
|
|
||||||
let mut piouff: u32 = 0;
|
loop {
|
||||||
while piouff != robot_pool.len() as u32 {
|
let mut piouff: u32 = 0;
|
||||||
for r in robot_pool {
|
for mut r in robot_pool {
|
||||||
if robot::is_piouff(&r) {
|
if robot::is_piouff(&r) {
|
||||||
piouff += 1;
|
piouff += 1;
|
||||||
} else {
|
} else {
|
||||||
@ -229,6 +229,9 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
check_map(&r, &world)?;
|
check_map(&r, &world)?;
|
||||||
check_collisions(&r, &hash)?;
|
check_collisions(&r, &hash)?;
|
||||||
}
|
}
|
||||||
|
if piouff == robot_pool.len() as u32 {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
Loading…
Reference in New Issue
Block a user