This commit is contained in:
Simponic 2021-04-21 11:33:18 -06:00
parent 37104c7e1c
commit 6d90b926fa
2 changed files with 33 additions and 10 deletions

View File

@ -1,19 +1,11 @@
(ql:quickload "cl-charms") (ql:quickload "cl-charms")
(ql:quickload "trivial-left-pad") (ql:quickload "trivial-left-pad")
(defvar *splits* '(("Chozo" 0 0 0)("Kraid" 0 0 0)("Wave Beam" 0 0 0)("Phantoon" 0 0 0)("Botwoon" 0 0 0)("Draygon" 0 0 0)("Ridley" 0 0 0)("Mother Brain" 0 0 0))) (defvar *splits* '(("Chozo" 0 0 0)("Kraid" 0 0 0)("Wave Beam" 0 0 0)("Phantoon" 0 0 0)("Botwoon" 0 0 0)("Draygon" 0 0 0)("Lower Norfair" 0 0 0)("Ridley" 0 0 0)("Mother Brain" 0 0 0)))
(defvar *current-split-index* 0) (defvar *current-split-index* 0)
(defvar *interval* internal-time-units-per-second) (defvar *interval* internal-time-units-per-second)
(defvar *start-time* 0) (defvar *start-time* 0)
(defun current-time ()
(let ((time (get-internal-real-time)))
(cond ((zerop *start-time*) (setf *start-time* time))
(t (- time *start-time*)))))
(defun time-to-millis (time)
(* (/ time *interval*) 1000))
(defun get-value (list index) (defun get-value (list index)
(cond (cond
((null list) nil) ((null list) nil)
@ -26,6 +18,34 @@
((zerop index) (setq list (cons value (cdr list)))) ((zerop index) (setq list (cons value (cdr list))))
(t (setq list (cons (car list) (change-value (cdr list) (1- index) value)))))) (t (setq list (cons (car list) (change-value (cdr list) (1- index) value))))))
(defun get-minimum (splits index current_minimum)
(cond
((null splits) '())
(t
(let ((val (get-value (car splits) index)))
(cond ((< val current_minimum)
(defun read-list-splits (filename)
(with-open-file (in filename)
(with-standard-io-syntax
(setf *splits* (read in)))))
(defun save-split-file (filename)
(with-open-file (out filename
:direction :output
:if-exists :append)
(with-standard-io-syntax
(print *splits* out))))
(defun current-time ()
(let ((time (get-internal-real-time)))
(cond ((zerop *start-time*) (setf *start-time* time))
(t (- time *start-time*)))))
(defun time-to-millis (time)
(* (/ time *interval*) 1000))
(defun add-to-string-if-not-empty (string suffix) (defun add-to-string-if-not-empty (string suffix)
(cond ((not (zerop (length string))) (concatenate 'string string suffix)))) (cond ((not (zerop (length string))) (concatenate 'string string suffix))))
@ -97,7 +117,7 @@
*splits* *splits*
*current-split-index*))))) *current-split-index*)))))
(defun hello-world () (defun hello-world (filename)
(charms:with-curses () (charms:with-curses ()
(charms:disable-echoing) (charms:disable-echoing)
(charms:enable-raw-input :interpret-control-characters t) (charms:enable-raw-input :interpret-control-characters t)
@ -118,6 +138,7 @@
((#\q) (return-from driver-loop))) ((#\q) (return-from driver-loop)))
(sleep 0.01) (sleep 0.01)
))) )))
(save-split-file filename)
(get-value *splits* (1- *current-split-index*)) (get-value *splits* (1- *current-split-index*))
) )

2
thing.out Normal file
View File

@ -0,0 +1,2 @@
(("Chozo" 10 538333/500 533333/500) ("Kraid" 1090 1770 680) ("Wave Beam" 1780 1158333/500 268333/500) ("Phantoon" 1163333/500 2890 281667/500) ("Botwoon" 2900 1733333/500 283333/500) ("Draygon" 1738333/500 3933333/1000 456667/1000) ("Lower Norfair" 3943333/1000 4463333/1000 520) ("Ridley" 4473333/1000 5033333/1000 560) ("Mother Brain" 5043333/1000 5680 636667/1000))