This file contains 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
#![feature(try_from)] | |
use std::convert::TryFrom; | |
fn do_add<'a>(state : &mut std::collections::HashMap<&'a str, i32>, thing_one : &'a str, thing_two : &'a str){ | |
let one = state.get(thing_one).unwrap().clone(); | |
let two = state.get(thing_two).unwrap().clone(); | |
state.insert(thing_one, 0); | |
state.insert(thing_two, one + two); | |
} |
This file contains 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
#![feature(try_from)] | |
use std::convert::TryFrom; | |
fn do_add<'a>(state : &mut std::collections::HashMap<&'a str, i32>, thing_one : &'a str, thing_two : &'a str){ | |
let one = state.get(thing_one).unwrap().clone(); | |
let two = state.get(thing_two).unwrap().clone(); | |
state.insert(thing_one, 0); | |
state.insert(thing_two, one + two); | |
} |
This file contains 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
#[derive(Debug)] | |
struct Floor { | |
micros : std::collections::HashSet<char>, | |
gens : std::collections::HashSet<char>, | |
} | |
fn parsefloor(room: &str) -> Floor { | |
let mut floor = Floor{ | |
micros: std::collections::HashSet::<char>::new(), | |
gens: std::collections::HashSet::<char>::new()}; |
This file contains 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
fn is_real(encrypted: &str, sum: &str) -> bool { | |
let mut counts : std::collections::HashMap<char, i32> = std::collections::HashMap::new(); | |
for c in encrypted.chars() { | |
counts.insert(c, 0); | |
} | |
for c in encrypted.chars() { | |
match c { | |
'-' => {}, | |
_ => { | |
let count = counts.get(&c).unwrap() + 1; |
This file contains 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
fn main (){ | |
let input = " 566 477 376 | |
575 488 365 | |
50 18 156 | |
558 673 498 | |
133 112 510 | |
670 613 25 | |
84 197 643 | |
910 265 611 |
This file contains 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
fn main (){ | |
let input = "DUURRDRRURUUUDLRUDDLLLURULRRLDULDRDUULULLUUUDRDUDDURRULDRDDDUDDURLDLLDDRRURRUUUDDRUDDLLDDDURLRDDDULRDUDDRDRLRDUULDLDRDLUDDDLRDRLDLUUUDLRDLRUUUDDLUURRLLLUUUUDDLDRRDRDRLDRLUUDUDLDRUDDUDLLUUURUUDLULRDRULURURDLDLLDLLDUDLDRDULLDUDDURRDDLLRLLLLDLDRLDDUULRDRURUDRRRDDDUULRULDDLRLLLLRLLLLRLURRRLRLRDLULRRLDRULDRRLRURDDLDDRLRDLDRLULLRRUDUURRULLLRLRLRRUDLRDDLLRRUDUDUURRRDRDLDRUDLDRDLUUULDLRLLDRULRULLRLRDRRLRLULLRURUULRLLRRRDRLULUDDUUULDULDUDDDUDLRLLRDRDLUDLRLRRDDDURUUUDULDLDDLDRDDDLURLDRLDURUDRURDDDDDDULLDLDLU | |
LURLRUURDDLDDDLDDLULRLUUUDRDUUDDUDLDLDDLLUDURDRDRULULLRLDDUDRRDRUDLRLDDDURDUURLUURRLLDRURDRLDURUDLRLLDDLLRDRRLURLRRUULLLDRLULURULRRDLLLDLDLRDRRURUUUDUDRUULDLUDLURLRDRRLDRUDRUDURLDLDDRUULDURDUURLLUDRUUUUUURRLRULUDRDUDRLLDUDUDUULURUURURULLUUURDRLDDRLUURDLRULDRRRRLRULRDLURRUULURDRRLDLRUURUDRRRDRURRLDDURLUDLDRRLDRLLLLRDUDLULUDRLLLDULUDUULLULLRLURURURDRRDRUURDULRDDLRULLLLLLDLLURLRLLRDLLRLUDLRUDDRLLLDDUDRLDLRLDUDU | |
RRDDLDLRRUULRDLLURLRURDLUURLLLUUDDULLDRURDUDRLRDRDDUUUULDLUDDLRDULDDRDDDDDLRRD |
This file contains 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
fn rotate(direction: &mut Vec<i32>, turn: &str){ | |
let x = direction[0]; | |
let y = direction[1]; | |
if turn == "L" { | |
direction[1] = x; | |
direction[0] = -y; | |
} else { | |
direction[1] = -x; | |
direction[0] = y; | |
} |