2016
Matthew Butterick 8 years ago
parent 1d1c9d323b
commit 785ca6d6c0

@ -8,9 +8,9 @@
(define match-result (regexp-match turn-pattern (string-trim tstr)))
`(turn ,@(cdr (or match-result empty)))))
(strip-bindings
#`(module day01-mod "day01.rkt"
#`(module day01-mod "lang.rkt"
#,@turn-datums)))
(module+ reader (provide read-syntax))
(provide read-syntax)
(define-macro (mb . TURNS)
#'(#%module-begin

@ -1,2 +1,2 @@
#lang aoc-racket/2016/day01
#lang reader "lang.rkt"
R4, R5, L5, L5, L3, R2, R1, R1, L5, R5, R2, L1, L3, L4, R3, L1, L1, R2, R3, R3, R1, L3, L5, R3, R1, L1, R1, R2, L1, L4, L5, R4, R2, L192, R5, L2, R53, R1, L5, R73, R5, L5, R186, L3, L2, R1, R3, L3, L3, R1, L4, L2, R3, L5, R4, R3, R1, L1, R5, R2, R1, R1, R1, R3, R2, L1, R5, R1, L5, R2, L2, L4, R3, L1, R4, L5, R4, R3, L5, L3, R4, R2, L5, L5, R2, R3, R5, R4, R2, R1, L1, L5, L2, L3, L4, L5, L4, L5, L1, R3, R4, R5, R3, L5, L4, L3, L1, L4, R2, R5, R5, R4, L2, L4, R3, R1, L2, R5, L5, R1, R1, L1, L5, L5, L2, L1, R5, R2, L4, L1, R4, R3, L3, R1, R5, L1, L4, R2, L3, R5, R3, R1, L3

@ -6,9 +6,9 @@
(for*/list ([msstr (in-list moveset-strs)])
`(moveset ,@(regexp-match* #rx"." msstr))))
(strip-bindings
#`(module day01-mod "day02b.rkt"
#`(module day01-mod "lang-b.rkt"
#,@moveset-datums)))
(module+ reader (provide read-syntax))
(provide read-syntax)
(define-macro moveset #'list)
(provide moveset)

@ -6,9 +6,9 @@
(for*/list ([msstr (in-list moveset-strs)])
`(moveset ,@(regexp-match* #rx"." msstr))))
(strip-bindings
#`(module day01-mod "day02.rkt"
#`(module day01-mod "lang.rkt"
#,@moveset-datums)))
(module+ reader (provide read-syntax))
(provide read-syntax)
(define-macro moveset #'list)
(provide moveset)

@ -1,4 +1,4 @@
#lang aoc-racket/2016/day02
#lang reader "lang-b.rkt"
DLRRRRLRLDRRRURRURULRLLULUURRRDDLDULDULLUUDLURLURLLDLUUUDUUUULDRDUUDUDDRRLRDDDUDLDLLRUURDRULUULRLRDULULLRLRLRLDRLUULDLDDDDRRLRUUUDDRURRULLLRURLUURULLRLUDDLDRUULDRURULRRRLLLRDLULDRRDDUDLURURLDULDRDRLDDUURRDUDDRDUURDULDUURDUDRDRULDUDUULRRULUUURDUURUDLDURDLRLURUUDRRDLRUDRULRURLDLLDLLRRDRDRLRRRULDRRLDUURLUUDLUUDDLLRULRDUUDURURLUURDRRRUDLRDULRRRLDRDULRUUDDDLRDUULDRLLDRULUULULRDRUUUULULLRLLLRUURUULRRLDDDRULRRRUDURUR
RULRUUUDLLUDURDRDDLLRLLUDRUDDRLRRDLDLDRDULDLULURDLUDDDUULURLDRUUURURLLRRDDDUUDRLRLLDLDRDDDRDUDLRDRDLLLDDLDUDDRUDUUDLLLLLDULRLURRRLLURUUULUDRLRLRLURRDRLLLRLLULRLLLDDLRLRDLUUUUUDULULDDULLUDUURDLRUDLRUDLRLLRLDLULRLDUDRURURDLRULDLULULDLLDLDLDLLLUDUDDLRLRRDULLUDRDDLLLDUURDULUDURLLLDRUDDDLRLULDLDRRDDDRDULDDUDRDDULLULRRLRUULRDUDURUDULUDUDURLDRDUUDDRRLRURDRRLRDDDDRUDLUDLDDLRDLUUDLRRURDDLURDLRDLLRDRDLDLDUUUURULUULDDDDLDULUURRRULUDLLLDRULDRURL
RRRLRDLLDUURDRRRLURDUULUDURDRRUUDURURRLDLLDRDLRRURDDUDDURLRUUDDULULRUUDRLUUDDLLDDDLRRRDLLLLLLRRURDULDLURRURRDDLDDDUDURRDURRRLUDRRULLRULDRLULRULDDRLLRDLRDUURULURLUURLRRULDULULUULDUDLRLDRDDRRRUUULULDUURLRLLURRLURDUUDDDRUULDLLLDRUURLRRLLDDUDRDLDDDULDRDDDUDRRLLLULURDUDLLUUURRLDULURURDDLUDLLRLDRULULURDLDRLURDLRRDRRUULLULDLURRDDUDRDDDLDUDLDRRUDRULDLDULRLLRRRRDDRLUURRRRDDLLRUURRLRURULDDULRLULRURRUULDUUDURDRRLRLUDRULDRUULUUDRDURDURRLULDDDULDDLRDURRUUUUUDDRRDLRDULUUDDL

@ -1,4 +1,4 @@
#lang aoc-racket/2016/day02b
#lang reader "lang.rkt"
DLRRRRLRLDRRRURRURULRLLULUURRRDDLDULDULLUUDLURLURLLDLUUUDUUUULDRDUUDUDDRRLRDDDUDLDLLRUURDRULUULRLRDULULLRLRLRLDRLUULDLDDDDRRLRUUUDDRURRULLLRURLUURULLRLUDDLDRUULDRURULRRRLLLRDLULDRRDDUDLURURLDULDRDRLDDUURRDUDDRDUURDULDUURDUDRDRULDUDUULRRULUUURDUURUDLDURDLRLURUUDRRDLRUDRULRURLDLLDLLRRDRDRLRRRULDRRLDUURLUUDLUUDDLLRULRDUUDURURLUURDRRRUDLRDULRRRLDRDULRUUDDDLRDUULDRLLDRULUULULRDRUUUULULLRLLLRUURUULRRLDDDRULRRRUDURUR
RULRUUUDLLUDURDRDDLLRLLUDRUDDRLRRDLDLDRDULDLULURDLUDDDUULURLDRUUURURLLRRDDDUUDRLRLLDLDRDDDRDUDLRDRDLLLDDLDUDDRUDUUDLLLLLDULRLURRRLLURUUULUDRLRLRLURRDRLLLRLLULRLLLDDLRLRDLUUUUUDULULDDULLUDUURDLRUDLRUDLRLLRLDLULRLDUDRURURDLRULDLULULDLLDLDLDLLLUDUDDLRLRRDULLUDRDDLLLDUURDULUDURLLLDRUDDDLRLULDLDRRDDDRDULDDUDRDDULLULRRLRUULRDUDURUDULUDUDURLDRDUUDDRRLRURDRRLRDDDDRUDLUDLDDLRDLUUDLRRURDDLURDLRDLLRDRDLDLDUUUURULUULDDDDLDULUURRRULUDLLLDRULDRURL
RRRLRDLLDUURDRRRLURDUULUDURDRRUUDURURRLDLLDRDLRRURDDUDDURLRUUDDULULRUUDRLUUDDLLDDDLRRRDLLLLLLRRURDULDLURRURRDDLDDDUDURRDURRRLUDRRULLRULDRLULRULDDRLLRDLRDUURULURLUURLRRULDULULUULDUDLRLDRDDRRRUUULULDUURLRLLURRLURDUUDDDRUULDLLLDRUURLRRLLDDUDRDLDDDULDRDDDUDRRLLLULURDUDLLUUURRLDULURURDDLUDLLRLDRULULURDLDRLURDLRRDRRUULLULDLURRDDUDRDDDLDUDLDRRUDRULDLDULRLLRRRRDDRLUURRRRDDLLRUURRLRURULDDULRLULRURRUULDUUDURDRRLRLUDRULDRUULUUDRDURDURRLULDDDULDDLRDURRUUUUUDDRRDLRDULUUDDL

@ -7,10 +7,10 @@
(slice-at (flatten (for/list ([triad (in-list triads)])
(apply map list triad))) 3))
(strip-bindings
#`(module mod "day03b.rkt"
#`(module mod "lang-b.rkt"
#,@(for*/list ([triple (in-list new-triples)])
`(triangle ,@triple)))))
(module+ reader (provide read-syntax))
(provide read-syntax)
(define-macro (mb . TRIANGLES)
#'(#%module-begin

@ -2,10 +2,10 @@
(define (read-syntax path port)
(strip-bindings
#`(module mod "day03.rkt"
#`(module mod "lang.rkt"
#,@(for*/list ([triangle-str (in-list (string-split (port->string port) "\n"))])
`(triangle ,@(string-split triangle-str))))))
(module+ reader (provide read-syntax))
(provide read-syntax)
(define-macro (mb . TRIANGLES)
#'(#%module-begin

@ -1,4 +1,4 @@
#lang aoc-racket/2016/day03
#lang reader "lang-b.rkt"
4 21 894
419 794 987
424 797 125

@ -1,4 +1,4 @@
#lang aoc-racket/2016/day03b
#lang reader "lang.rkt"
4 21 894
419 794 987
424 797 125

@ -1,4 +1,4 @@
#lang aoc-racket/2016/day04
#lang reader "lang.rkt"
bkwzkqsxq-tovvilokx-nozvyiwoxd-172[fstek]
wifilzof-wbiwifuny-yhachyylcha-526[qrazx]
jvyyvzpcl-jhukf-shivyhavyf-487[zhtsi]

@ -2,11 +2,11 @@
(define (read-syntax path port)
(strip-bindings
#`(module mod "day04.rkt"
#`(module mod "lang.rkt"
#,@(for*/list ([room-str (in-lines port)]
#:when (not (equal? "" room-str)))
`(room ,@(cdr (regexp-match #px"^(.*)-(\\d+)\\[(\\w+)\\]$" room-str)))))))
(module+ reader (provide read-syntax))
(provide read-syntax)
#|
Each room consists of an encrypted name (lowercase letters separated by dashes)

@ -1,4 +1,4 @@
#lang aoc-racket/2016/day04
#lang reader "lang.rkt"
aaaaa-bbb-z-y-x-123[abxyz]
a-b-c-d-e-f-g-h-987[abcde]
not-a-real-room-404[oarel]

@ -1,2 +0,0 @@
#lang aoc-racket/2016/day05
ojvtpuvg

@ -0,0 +1,2 @@
#lang reader "lang.rkt"
ojvtpuvg

@ -1,11 +1,10 @@
#lang br/quicklang
(require openssl/md5)
(provide read-syntax)
(define (read-syntax path port)
(strip-bindings
#`(module mod "day05.rkt"
#`(module mod "lang.rkt"
(solve #,(string-trim (port->string port))))))
(module+ reader (provide read-syntax))
(provide #%module-begin)

@ -1,4 +1,4 @@
#lang aoc-racket/2016/day06
#lang reader "lang.rkt"
focdealm
ggsipflx
rvibwxbm

@ -1,8 +1,8 @@
#lang br/quicklang
(provide read-syntax)
(define (read-syntax path port)
(strip-bindings
#`(module mod "day06.rkt"
#`(module mod "lang.rkt"
(solve #,@(string-split (port->string port))))))
(module+ reader (provide read-syntax))

@ -1,4 +1,4 @@
#lang aoc-racket/2016/day06
#lang reader "lang.rkt"
eedadn
drvtee
eandsr

@ -1,5 +0,0 @@
#lang aoc-racket/2016/day07
abba[mnop]qrst
abcd[bddb]xyyx
aaaa[qwer]tyui
ioxxoj[asdfgh]zxcvbn

@ -1,4 +1,4 @@
#lang aoc-racket/2016/day07
#lang reader "lang.rkt"
dnwtsgywerfamfv[gwrhdujbiowtcirq]bjbhmuxdcasenlctwgh
rnqfzoisbqxbdlkgfh[lwlybvcsiupwnsyiljz]kmbgyaptjcsvwcltrdx[ntrpwgkrfeljpye]jxjdlgtntpljxaojufe
jgltdnjfjsbrffzwbv[nclpjchuobdjfrpavcq]sbzanvbimpahadkk[yyoasqmddrzunoyyk]knfdltzlirrbypa

@ -1,9 +1,9 @@
#lang br/quicklang
(module+ reader (provide read-syntax))
(provide read-syntax)
(define (read-syntax path port)
(strip-bindings
#`(module mod "day07.rkt"
#`(module mod "lang.rkt"
#,@(for/list ([ip (in-lines port)]
#:when (not (equal? ip "")))
ip))))

@ -0,0 +1,5 @@
#lang reader "lang.rkt"
abba[mnop]qrst
abcd[bddb]xyyx
aaaa[qwer]tyui
ioxxoj[asdfgh]zxcvbn

@ -1,4 +1,4 @@
#lang aoc-racket/2016/day08
#lang reader "lang.rkt"
rect 1x1
rotate row y=0 by 20
rect 1x1

@ -1,9 +1,8 @@
#lang br/quicklang
(module+ reader (provide read-syntax))
(provide read-syntax)
(define (read-syntax path port)
(strip-bindings
#`(module mod "day08.rkt"
#`(module mod "lang.rkt"
#,@(for/list ([inst (in-lines port)]
#:when (not (equal? inst "")))
(format-datum '(~a) inst)))))

@ -1,4 +1,4 @@
#lang aoc-racket/2016/day08
#lang reader "lang.rkt"
rect 3x2
rotate column x=1 by 1
rotate row y=0 by 4

@ -1,2 +0,0 @@
#lang aoc-racket/2016/day09
(27x12)(20x12)(13x14)(7x10)(1x12)A

File diff suppressed because one or more lines are too long

@ -1,10 +1,9 @@
#lang br/quicklang
(require racket/string)
(module+ reader (provide read-syntax))
(provide read-syntax)
(define (read-syntax path port)
(strip-bindings
#`(module mod "day09.rkt"
#`(module mod "lang.rkt"
#,@(for/list ([str (in-lines port)]
#:when (not (equal? str "")))
`(solve ,(string-trim str))))))

@ -0,0 +1,2 @@
#lang reader "lang.rkt"
(27x12)(20x12)(13x14)(7x10)(1x12)A

@ -0,0 +1,2 @@
#lang reader "lang.rkt"
ahsbgdzn

@ -0,0 +1,15 @@
#lang br/quicklang
(require openssl/md5)
;; http://adventofcode.com/2016/day/13
(require graph)
(provide read-syntax
(rename-out [mb #%module-begin]))
(define (read-syntax path port)
(strip-bindings
#`(module mod "lang.rkt"
#,(string-trim (port->string port)))))
(define-macro (mb SALT)
#'(#%module-begin
(md5 (open-input-string SALT))))

@ -0,0 +1,2 @@
#lang reader "lang.rkt"
abc