/// This metric calculates the percentage of walkable cells (Floor).
/// If this number is very low (like < 10%) then it means that the map 
/// is probably to degenerated and shouldn't be used
This metric calculates the percentage of walkable cells (Floor).
If this number is very low (like < 10%) then it means that the map
is probably to degenerated and shouldn't be used
This metric calculates the percentage of walkable cells ( Floor ) . If this number is very low ( like < 10% ) then it means that the map is probably to degenerated and shouldn ' t be used
pub fn density(map: &Map) -> f32 {
    let floor_count = map.tiles.iter()
        .filter(|&t| t.is_walkable())
        .count();
    floor_count as f32 / map.tiles.len() as f32
}
pub fn density ( map : & Map ) -> f32 { let floor_count = map . tiles . iter ( ) . filter ( | & t | t . is_walkable ( ) ) . count ( ) ; floor_count as f32 / map . tiles . len ( ) as f32 }
This metric calculates the percentage of walkable cells (Floor).
This metric calculates the percentage of walkable cells ( Floor ) .
map
&Map