Created
July 4, 2014 20:45
-
-
Save icecreammatt/b58f225b3227228cba80 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #[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