Add create_map()
This commit is contained in:
		
							parent
							
								
									26a25d7e79
								
							
						
					
					
						commit
						6c19f303fa
					
				@ -9,6 +9,13 @@ struct World {
 | 
				
			|||||||
    map: Vec<char>,
 | 
					    map: Vec<char>,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					impl World {
 | 
				
			||||||
 | 
					    /// Create a new map full of dots.
 | 
				
			||||||
 | 
					    fn create_map(&mut self) {
 | 
				
			||||||
 | 
					        self.map = vec!['.'; (self.x * self.y) as usize];
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/// Struct to store robot position.
 | 
					/// Struct to store robot position.
 | 
				
			||||||
struct Position {
 | 
					struct Position {
 | 
				
			||||||
    x: u32,
 | 
					    x: u32,
 | 
				
			||||||
@ -112,6 +119,7 @@ fn open_file(filename: &str) -> io::Result<String> {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
 | 
					fn main() -> Result<(), Box<dyn std::error::Error>> {
 | 
				
			||||||
 | 
					    // We handle CLI flags here.
 | 
				
			||||||
    let matches = App::new("DancingDroids")
 | 
					    let matches = App::new("DancingDroids")
 | 
				
			||||||
        .version("0.1.0")
 | 
					        .version("0.1.0")
 | 
				
			||||||
        .about("When droids dance togethers")
 | 
					        .about("When droids dance togethers")
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user