+
+ fn set_each<F: FnMut(usize, usize) -> bool>(&mut self, mut func: F, walls: usize) {
+ for x in walls..(self.width - walls) {
+ for y in walls..(self.height - walls) {
+ self.cells[x][y] = func(x, y);
+ }
+ }
+ }
+
+ fn subdivide(&mut self) -> Grid {
+ let (width, height) = (self.width * 2, self.height * 2);
+ let mut cells = vec!(vec!(true; height); width);
+ for x in 1..(width - 1) {
+ for y in 1..(height - 1) {
+ cells[x][y] = self.cells[x / 2][y / 2];
+ }
+ }
+ Grid {
+ cell_size: self.cell_size / 2,
+ width,
+ height,
+ cells
+ }
+ }