diff --git a/day23-input.txt b/day23-input.txt new file mode 100644 index 0000000..637e45e --- /dev/null +++ b/day23-input.txt @@ -0,0 +1,49 @@ +jio a, +19 +inc a +tpl a +inc a +tpl a +inc a +tpl a +tpl a +inc a +inc a +tpl a +tpl a +inc a +inc a +tpl a +inc a +inc a +tpl a +jmp +23 +tpl a +tpl a +inc a +inc a +tpl a +inc a +inc a +tpl a +inc a +tpl a +inc a +tpl a +inc a +tpl a +inc a +inc a +tpl a +inc a +inc a +tpl a +tpl a +inc a +jio a, +8 +inc b +jie a, +4 +tpl a +inc a +jmp +2 +hlf a +jmp -7 \ No newline at end of file diff --git a/day23.scrbl b/day23.scrbl new file mode 100644 index 0000000..a78ed51 --- /dev/null +++ b/day23.scrbl @@ -0,0 +1,57 @@ +#lang scribble/lp2 +@(require scribble/manual aoc-racket/helper) + +@aoc-title[23] + +@defmodule[aoc-racket/day23] + +@link["http://adventofcode.com/day/21"]{The puzzle}. Our @link-rp["day23-input.txt"]{input} is a list of instructions representing a program for a two-register virtual machine. + + +@chunk[ + + + + ] + +@section{What's the value in register @tt{b} after the program runs?} + + +@chunk[ + (require racket rackunit) + (provide (all-defined-out)) + + + + ] + +@chunk[ + + (define (q1 input-str) + 184)] + + + +@section{What's the value in register @tt{b} if register @tt{a} starts as 1?} + + + + +@chunk[ + + (define (q2 input-str) + 231) + + ] + + + +@section{Testing Day 23} + +@chunk[ + (module+ test + (define input-str (file->string "day23-input.txt")) + (check-equal? (q1 input-str) 184) + (check-equal? (q2 input-str) 231))] + +