Merge branch 'documentation' into 'master'
documentation See merge request mhart/DancingDroids!72
This commit is contained in:
		
						commit
						4cd94ac377
					
				@ -59,6 +59,7 @@ fn create_hash_map(pool: &Vec<robot::Robot>, hash: &mut HashMap<robot::Position,
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Generate a new world.
 | 
			
		||||
fn gen_world(pool: &mut Vec<robot::Robot>) -> Result<world::World, String> {
 | 
			
		||||
    let w = world::random_world();
 | 
			
		||||
    let mut rng = rand::thread_rng();
 | 
			
		||||
 | 
			
		||||
@ -59,6 +59,7 @@ pub enum Orientation {
 | 
			
		||||
    W,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Return new Orientation with a left move apply to it.
 | 
			
		||||
fn turn_left(o: &Orientation) -> Orientation {
 | 
			
		||||
    match o {
 | 
			
		||||
        Orientation::N => Orientation::W,
 | 
			
		||||
@ -67,6 +68,8 @@ fn turn_left(o: &Orientation) -> Orientation {
 | 
			
		||||
        Orientation::W => Orientation::S,
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Return new Orientation with a right move apply to it.
 | 
			
		||||
fn turn_right(o: &Orientation) -> Orientation {
 | 
			
		||||
    match o {
 | 
			
		||||
        Orientation::N => Orientation::E,
 | 
			
		||||
@ -84,6 +87,7 @@ pub enum Instruction {
 | 
			
		||||
    F,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Convert a string of instructions to a Vec of instructions.
 | 
			
		||||
pub fn instructions_from_string(s: String) -> Result<Vec<Instruction>, String> {
 | 
			
		||||
    let mut v: Vec<Instruction> = Vec::new();
 | 
			
		||||
    for c in s.chars() {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user