1
0
Fork 0
This commit is contained in:
Jonathan Chan 2022-12-02 01:17:50 -05:00
parent 189b4894a2
commit c26d932a61
2 changed files with 2533 additions and 0 deletions

2500
input/02.txt Normal file

File diff suppressed because it is too large Load Diff

33
src/02.rkt Normal file
View File

@ -0,0 +1,33 @@
#lang racket
(require "../lib.rkt")
(define input (map string-words (problem-input 2)))
(define part1
(for/sum ([round input])
(match round
['("A" "X") (+ 1 3)]
['("B" "X") (+ 1 0)]
['("C" "X") (+ 1 6)]
['("A" "Y") (+ 2 6)]
['("B" "Y") (+ 2 3)]
['("C" "Y") (+ 2 0)]
['("A" "Z") (+ 3 0)]
['("B" "Z") (+ 3 6)]
['("C" "Z") (+ 3 3)])))
(define part2
(for/sum ([round input])
(match round
['("A" "X") (+ 3 0)]
['("B" "X") (+ 1 0)]
['("C" "X") (+ 2 0)]
['("A" "Y") (+ 1 3)]
['("B" "Y") (+ 2 3)]
['("C" "Y") (+ 3 3)]
['("A" "Z") (+ 2 6)]
['("B" "Z") (+ 3 6)]
['("C" "Z") (+ 1 6)])))
(show-solution part1 part2)