There are numbers next to the names on the leaderboard (eg the 22
in 1) 22 * yfzhe
). What do those mean?
Something like scores?
Those are the scores. The first person to complete a puzzle gets 2*num_entrants
points, the next person gets 2 less, and so on. If you only complete half the puzzle you get half the points. Scores are recalculated when people enter/leave the leaderboard.
@slack1 has joined the channel
(def FILE "../data/1.txt")
(def data (~>> FILE file->lines (map string->number)))
;; ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
;; Solve
(fn (step n) (~> n (quotient _ 3) (- 2)))
(fn (score n) (apply + (unfold negative? identity step (step n))))
(def A (~>> data (map step) (apply +)))
(def B (~>> data (map score) (apply +)))
If you are using threading
you can remove some of those _
by using ~>>
ohh thanks
And you can replace (* 1/3) floor
with (quotient _ 3)
.
@dan has joined the channel
The difficulty increased a bit from yesterday :stuck_out_tongue:
and increased from last year, IMHO
Here are the total completion stats: https://adventofcode.com/2019/stats