pub fn perform_generation (width : usize, height : usize, tiles : &mut Vec<TileType>, wall : TileType, floor : TileType) {
	info!("Generating...");

	for x in 1..width-1 {
		for y in 1..height-1 {
			let surrounding_wall_count = get_surrounding_neighbor_count(width, height, tiles, wall, x as i32, y as i32);

			match tiles[x+y*width] {
				_ if tiles[x+y*width] == wall => {
					if surrounding_wall_count >= 4 {
						tiles[x+y*width] = wall;
					}
					if surrounding_wall_count < 2 {
						tiles[x+y*width] = floor;
					}
				},
				_ => {
					if surrounding_wall_count >= 5 {
						tiles[x+y*width] = wall;
					}
				}
			}
		}
	}
}
/// Performs a single generation of the cellular automata 
/// according to the B5678/S45678 rule.
Performs a single generation of the cellular automata
according to the B5678/S45678 rule.
Performs a single generation of the cellular automata according to the B5678 / S45678 rule .
pub fn perform_generation (width : usize, height : usize, tiles : &mut Vec<TileType>, wall : TileType, floor : TileType) {
	info!("Generating...");
	for x in 1..width-1 {
		for y in 1..height-1 {
			let surrounding_wall_count = get_surrounding_neighbor_count(width, height, tiles, wall, x as i32, y as i32);
			match tiles[x+y*width] {
				_ if tiles[x+y*width] == wall => {
					if surrounding_wall_count >= 4 {
						tiles[x+y*width] = wall;
					}
					if surrounding_wall_count < 2 {
						tiles[x+y*width] = floor;
					}
				},
				_ => {
					if surrounding_wall_count >= 5 {
						tiles[x+y*width] = wall;
					}
				}
			}
		}
	}
}
pub fn perform_generation ( width : usize , height : usize , tiles : & mut Vec < TileType > , wall : TileType , floor : TileType ) { info ! ( " " ) ; for x in 1 .. width - 1 { for y in 1 .. height - 1 { let surrounding_wall_count = get_surrounding_neighbor_count ( width , height , tiles , wall , x as i32 , y as i32 ) ; match tiles [ x + y * width ] { _ if tiles [ x + y * width ] == wall => { if surrounding_wall_count >= 4 { tiles [ x + y * width ] = wall ; } if surrounding_wall_count < 2 { tiles [ x + y * width ] = floor ; } } , _ => { if surrounding_wall_count >= 5 { tiles [ x + y * width ] = wall ; } } } } } }
Performs a single generation of the cellular automata
according to the B5678/S45678 rule.
Performs a single generation of the cellular automata according to the B5678 / S45678 rule .
width
usize
height
usize
tiles
&mut Vec<TileType>
wall
TileType
floor
TileType
width
usize
height
usize
tiles
&mut Vec<TileType>
wall
TileType
floor
TileType