Initial commit
This commit is contained in:
commit
f242d2b0df
420 changed files with 62521 additions and 0 deletions
43
2019/day21/day21.rkt
Normal file
43
2019/day21/day21.rkt
Normal file
|
@ -0,0 +1,43 @@
|
|||
#lang racket/base
|
||||
|
||||
(require "../intcode.rkt")
|
||||
|
||||
(module+ test
|
||||
(require rackunit))
|
||||
|
||||
(define (part1 program)
|
||||
(define inputs #<<EOF
|
||||
OR A J
|
||||
AND B J
|
||||
AND C J
|
||||
NOT J J
|
||||
AND D J
|
||||
WALK
|
||||
|
||||
EOF
|
||||
)
|
||||
(define vm (execute (start-machine program inputs)))
|
||||
(car (machine-outputs vm)))
|
||||
|
||||
(module+ test
|
||||
(check-equal? (part1 (parse-file "input")) 19359533))
|
||||
|
||||
(define (part2 program)
|
||||
(define inputs #<<EOF
|
||||
OR A J
|
||||
AND B J
|
||||
AND C J
|
||||
NOT J J
|
||||
AND D J
|
||||
OR E T
|
||||
OR H T
|
||||
AND T J
|
||||
RUN
|
||||
|
||||
EOF
|
||||
)
|
||||
(define vm (execute (start-machine program inputs)))
|
||||
(car (machine-outputs vm)))
|
||||
|
||||
(module+ test
|
||||
(check-equal? (part2 (parse-file "input")) 1140310551))
|
1
2019/day21/input
Normal file
1
2019/day21/input
Normal file
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue