Day 23, part 2
This commit is contained in:
		
							
								
								
									
										20
									
								
								src/bin/d23p2.rs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								src/bin/d23p2.rs
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,20 @@
 | 
				
			|||||||
 | 
					use aoc22::{
 | 
				
			||||||
 | 
					    day23::{self},
 | 
				
			||||||
 | 
					    util,
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					pub fn main() {
 | 
				
			||||||
 | 
					    let mut elves = day23::parse_map(&util::parse_input());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    let mut i = 0;
 | 
				
			||||||
 | 
					    loop {
 | 
				
			||||||
 | 
					        let elves_too_close = day23::do_round(&mut elves, i);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        i += 1;
 | 
				
			||||||
 | 
					        if !elves_too_close {
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    println!("First idle round: {}", i);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user