zilti's function of madness added by zilti on Thu Dec 7 18:56:04 2023
(define (get-distance race hold-time) (let ((time-remaining (- (race-time-limit race) hold-time))) (* time-remaining hold-time))) (define (calc-race-distances-with-counter race #!optional (hold-time 1) (winning-distances 0) (losing-distances 0)) (let* ((record-distance (race-record-distance race)) (new-distance (get-distance race hold-time)) (is-new-record? (> new-distance record-distance))) (cond ((= new-distance 0) (begin (race-winning-distances-set! race winning-distances) (race-losing-distances-set! race losing-distances) race)) (else (calc-race-distances race (+ hold-time 1) (if is-new-record? (+ 1 winning-distances) winning-distances) (if is-new-record? losing-distances (+ 1 losing-distances)))))))