add scribble view for plot lol
This commit is contained in:
parent
5365272e27
commit
06ab477340
32
scripts/plot
32
scripts/plot
|
@ -1,9 +1,10 @@
|
||||||
#!/usr/bin/env racket
|
#!/usr/bin/env racket
|
||||||
#lang racket
|
#lang racket
|
||||||
|
|
||||||
(require "aoc-lib.rkt" plot)
|
(require "aoc-lib.rkt" plot/no-gui)
|
||||||
(plot-new-window? #t)
|
(provide make-plot)
|
||||||
|
|
||||||
|
(define (make-plot plot-func)
|
||||||
(define data
|
(define data
|
||||||
(aoc-fetch-leaderboard (getenv "AOC_YEAR") (getenv "AOC_LEADERBOARD") (getenv "AOC_SESSION")))
|
(aoc-fetch-leaderboard (getenv "AOC_YEAR") (getenv "AOC_LEADERBOARD") (getenv "AOC_SESSION")))
|
||||||
|
|
||||||
|
@ -41,23 +42,6 @@
|
||||||
(hash-update! timeline time (lambda (v) (cons (tl-entry mid day level) v)) '())])))
|
(hash-update! timeline time (lambda (v) (cons (tl-entry mid day level) v)) '())])))
|
||||||
|
|
||||||
(define timestamps (sort (hash-keys timeline) <))
|
(define timestamps (sort (hash-keys timeline) <))
|
||||||
;; vector of day to vector of part to ordered list of solvers
|
|
||||||
; (define chals (for/vector ([day (in-range 1 26)]) (make-vector 2 '())))
|
|
||||||
;
|
|
||||||
; (for ([time (in-list timestamps)])
|
|
||||||
; (for ([solve (in-list (hash-ref timeline time))])
|
|
||||||
; (match-define (tl-entry mid day level) solve)
|
|
||||||
; (define old (vector-ref (vector-ref chals (sub1 day)) (sub1 level)))
|
|
||||||
; (vector-set! (vector-ref chals (sub1 day)) (sub1 level) (append old (list mid)))))
|
|
||||||
;
|
|
||||||
; (define (total-points mem)
|
|
||||||
; ;; day 1 is worth no points u___u
|
|
||||||
; (for*/sum ([day (in-range 2 26)] [level (in-range 1 3)])
|
|
||||||
; (define solves-for-day (vector-ref (vector-ref chals (sub1 day)) (sub1 level)))
|
|
||||||
; (match (index-of solves-for-day mem)
|
|
||||||
; [#f 0]
|
|
||||||
; [x (- max-pts x)])))
|
|
||||||
; (total-points 1067937)
|
|
||||||
|
|
||||||
(define point-values (make-hash))
|
(define point-values (make-hash))
|
||||||
(for* ([day (in-range 1 26)] [level (in-range 1 3)])
|
(for* ([day (in-range 1 26)] [level (in-range 1 3)])
|
||||||
|
@ -101,7 +85,8 @@
|
||||||
(sort (hash-keys point-tls)
|
(sort (hash-keys point-tls)
|
||||||
(lambda (a b)
|
(lambda (a b)
|
||||||
(>= (get-last-pts (hash-ref point-tls a)) (get-last-pts (hash-ref point-tls b))))))
|
(>= (get-last-pts (hash-ref point-tls a)) (get-last-pts (hash-ref point-tls b))))))
|
||||||
(plot (for/list ([mid (in-list ordered-mids)])
|
(plot-func
|
||||||
|
(for/list ([mid (in-list ordered-mids)])
|
||||||
(lines (hash-ref point-tls mid)
|
(lines (hash-ref point-tls mid)
|
||||||
#:label (format "~a (~a pts)" (hash-ref member-names mid)
|
#:label (format "~a (~a pts)" (hash-ref member-names mid)
|
||||||
(get-last-pts (hash-ref point-tls mid)))
|
(get-last-pts (hash-ref point-tls mid)))
|
||||||
|
@ -109,4 +94,9 @@
|
||||||
#:style mid
|
#:style mid
|
||||||
#:width 2))
|
#:width 2))
|
||||||
#:x-label "date/time"
|
#:x-label "date/time"
|
||||||
#:y-label "points")
|
#:y-label "points"))
|
||||||
|
|
||||||
|
(module+ main
|
||||||
|
(require plot)
|
||||||
|
(plot-new-window? #t)
|
||||||
|
(make-plot plot))
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
html, body { background: black; color: white; font-family: monospace; }
|
||||||
|
|
||||||
|
h1, h2, h3, p { font-family: monospace; }
|
|
@ -0,0 +1,10 @@
|
||||||
|
#lang scribble/base
|
||||||
|
|
||||||
|
@(require plot/no-gui racket "plot")
|
||||||
|
|
||||||
|
@title[#:style '(toc-hidden no-sidebar no-index no-toc+aux)]{BLÁHAJ score chart}
|
||||||
|
|
||||||
|
meow
|
||||||
|
|
||||||
|
@(parameterize ([plot-width 2048] [plot-height 1024])
|
||||||
|
(make-plot plot-pict))
|
Loading…
Reference in New Issue