Skip to content

Instantly share code, notes, and snippets.

@icecreammatt
Created July 4, 2014 20:45
Show Gist options
  • Select an option

  • Save icecreammatt/b58f225b3227228cba80 to your computer and use it in GitHub Desktop.

Select an option

Save icecreammatt/b58f225b3227228cba80 to your computer and use it in GitHub Desktop.
#[allow(dead_code)]
struct Point {
x: uint,
y: uint,
}
#[allow(dead_code)]
struct Cell {
point: Point,
isWall: bool
}
fn main() {
let max_width = 3u;
let max_height = 3u;
let mut vec: Vec<Cell> = Vec::new();
let mut rowIndex = 0u;
'outer: loop {
let mut colIndex = 0u;
'inner: loop {
let cell = Cell { point: Point { x: colIndex, y: rowIndex },
isWall: false };
vec.push(cell);
let mut cell = *vec.get(colIndex);
cell.isWall = true;
// cell.point.x = 2;
println!("cell {}", cell.isWall);
colIndex += 1;
if colIndex > max_width {
break 'inner;
}
}
rowIndex += 1;
if rowIndex > max_height {
break 'outer;
}
}
for cell in vec.iter() {
println!("cell {}", cell.isWall);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment