From 4fd65af5b186dcd8525e9734f5c2f68228ea3d1a Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Mon, 12 Dec 2016 00:35:32 -0500 Subject: Day 12 part 2 --- src/bin/day12.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/bin/day12.rs b/src/bin/day12.rs index 64b09f8..6655947 100644 --- a/src/bin/day12.rs +++ b/src/bin/day12.rs @@ -108,17 +108,25 @@ impl Vm { } } -fn solve(input: &str) -> i32 { +fn solve1(input: &str) -> i32 { let mut vm: Vm = input.parse().unwrap(); while vm.step() { } vm.registers[0] } +fn solve2(input: &str) -> i32 { + let mut vm: Vm = input.parse().unwrap(); + vm.registers[2] = 1; + while vm.step() { } + vm.registers[0] +} + fn main() { let mut input = String::new(); io::stdin().read_to_string(&mut input).unwrap(); - println!("Part 1: {}", solve(&input)); + println!("Part 1: {}", solve1(&input)); + println!("Part 2: {}", solve2(&input)); } #[test] @@ -131,5 +139,5 @@ dec a jnz a 2 dec a "; - assert_eq!(42, solve(input.trim())); + assert_eq!(42, solve1(input.trim())); } -- cgit 1.4.1 a href='/catgirl/refs/?h=1.0&id=252428f97aa6a8f4e5b612757ce96d2d0d37e2f3'>refs log tree commit diff
path: root/ui.c (unfollow)
Commit message (Expand)Author
2020-02-11Exit focus and paste modes on err exitJune McEnroe
2020-02-11Add startup GPLv3 note and URLJune McEnroe
2020-02-11Make sure -D_GNU_SOURCE ends up in CFLAGS on LinuxJune McEnroe
2020-02-11Add note about setting PKG_CONFIG_PATHJune McEnroe
2020-02-11Rename query ID on nick changeJune McEnroe
2020-02-11Call completeClear when closing a windowJune McEnroe
2020-02-11Don't insert color codes for non-mentionsJune McEnroe
2020-02-11Take first two words in colorMentionsJune McEnroe
2020-02-11Use time_t for save signatureJune McEnroe
2020-02-11Set self.nick to * initiallyJune McEnroe
2020-02-11Define ColorCap instead of hardcoding 100June McEnroe
2020-02-11Move hash to top of chat.hJune McEnroe
2020-02-11Move base64 out of chat.hJune McEnroe
2020-02-11Move XDG_SUBDIR out of chat.hJune McEnroe
2020-02-11Fix whois idle unit calculationJune McEnroe
2020-02-11Cast towupper to wchar_tJune McEnroe
2020-02-11Cast set but unused variables to voidJune McEnroe
2020-02-11Declare strlcatJune McEnroe
2020-02-11Check if VDSUSP existsJune McEnroe
2020-02-11Fix completeReplace iterationJune McEnroe
2020-02-11Use pkg(8) to configure on FreeBSDJune McEnroe
2020-02-11Remove legacy codeJune McEnroe
2020-02-11Add INSTALLING section to READMEJune McEnroe