MCPcopy Create free account
hub / github.com/AxlLind/AdventOfCode / part_two

Function part_two

2019/src/bin/13.rs:31–52  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

29}
30
31fn part_two() -> i64 {
32 let mut program = PROGRAM;
33 program[0] = 2;
34 let mut cpu = IntCoder::new(&program);
35 let (mut bx, mut px, mut score) = (0,0,0);
36 loop {
37 match cpu.execute() {
38 ExitCode::Output(x) => {
39 let y = cpu.execute_until_output();
40 let v = cpu.execute_until_output();
41 match (x,y,v) {
42 (-1,0,v) => score = v,
43 (x,_,3) => px = x,
44 (x,_,4) => bx = x,
45 _ => {}
46 }
47 },
48 ExitCode::AwaitInput => cpu.push_input(cmp_xs(bx,px)),
49 ExitCode::Halted => break score,
50 }
51 }
52}
53
54fn main() {
55 let now = Instant::now();

Callers

nothing calls this directly

Calls 4

cmp_xsFunction · 0.85
executeMethod · 0.80
execute_until_outputMethod · 0.80
push_inputMethod · 0.80

Tested by

no test coverage detected