2021-04-24 23:20:12 -04:00
|
|
|
(load "helper.lisp")
|
|
|
|
(load "splits.lisp")
|
2021-04-18 01:18:03 -04:00
|
|
|
|
2021-04-24 23:20:12 -04:00
|
|
|
(defvar current-split '())
|
|
|
|
(defvar done-splits '())
|
|
|
|
(defvar last-time-space-pressed 0)
|
|
|
|
(defvar pb 0)
|
2021-04-18 01:18:03 -04:00
|
|
|
|
2021-04-24 23:20:12 -04:00
|
|
|
(defun read-in-splits (filename)
|
2021-04-20 00:23:47 -04:00
|
|
|
(cond
|
2021-04-24 23:20:12 -04:00
|
|
|
((y-or-n-p "Read file")
|
|
|
|
(read-file-of-splits filename)
|
|
|
|
(setf
|
|
|
|
*splits*
|
|
|
|
(set-column-in-run-from-other-run
|
|
|
|
2
|
|
|
|
(make-run-of-best-segments *all-splits* 0)
|
|
|
|
*splits*))
|
|
|
|
(setf
|
|
|
|
*splits*
|
|
|
|
(set-column-in-run-from-other-run
|
|
|
|
3
|
|
|
|
(get-best-run *all-splits* (car *all-splits*) (cadr (car *splits*)))
|
|
|
|
*splits*))))
|
|
|
|
(setf pb (sum-splits *splits* 3))
|
|
|
|
(setf current-split (car *splits*))
|
|
|
|
(setf *splits* (cdr *splits*))
|
|
|
|
)
|
2021-04-18 01:18:03 -04:00
|
|
|
|
2021-04-24 23:20:12 -04:00
|
|
|
(defun main (filename)
|
|
|
|
(read-in-splits filename)
|
|
|
|
(setf last-time-space-pressed (get-internal-real-time))
|
2021-04-18 01:18:03 -04:00
|
|
|
(charms:with-curses ()
|
|
|
|
(charms:disable-echoing)
|
2021-04-20 00:23:47 -04:00
|
|
|
(charms:enable-raw-input :interpret-control-characters t)
|
|
|
|
(charms:enable-non-blocking-mode charms:*standard-window*)
|
|
|
|
(loop :named driver-loop
|
|
|
|
:for c := (charms:get-char charms:*standard-window*
|
|
|
|
:ignore-error t)
|
|
|
|
:do (progn
|
|
|
|
(charms:clear-window charms:*standard-window*)
|
2021-04-24 23:20:12 -04:00
|
|
|
(if (null current-split) (return-from driver-loop))
|
|
|
|
(charms:write-string-at-point charms:*standard-window* (make-output (push-on-list current-split done-splits) 0 pb) 0 0)
|
2021-04-20 00:23:47 -04:00
|
|
|
(charms:refresh-window charms:*standard-window*)
|
2021-04-24 23:20:12 -04:00
|
|
|
(setf current-split (update-split current-split last-time-space-pressed))
|
2021-04-20 00:23:47 -04:00
|
|
|
(case c
|
|
|
|
((nil) nil)
|
2021-04-24 23:20:12 -04:00
|
|
|
((#\Space)
|
|
|
|
(progn
|
|
|
|
(setf last-time-space-pressed (get-internal-real-time))
|
|
|
|
(setf done-splits (push-on-list current-split done-splits))
|
|
|
|
(setf current-split (car *splits*))
|
|
|
|
(setf *splits* (cdr *splits*))))
|
2021-04-20 00:23:47 -04:00
|
|
|
((#\q) (return-from driver-loop)))
|
|
|
|
(sleep 0.01)
|
|
|
|
)))
|
2021-04-24 23:20:12 -04:00
|
|
|
(setf *all-splits* (cons done-splits *all-splits*))
|
|
|
|
(cond ((y-or-n-p "Save?") (with-open-file (output filename :direction :output :if-exists :supersede) (print *all-splits* output))))
|
|
|
|
(format nil (format-time (sum-splits done-splits 1))))
|