- (let ((new-scores (append (score-challenger-matches spec challenger-prog hill-progs)
- scores)))
- (save-scores new-scores hill-dir)
- (hill-add-file challenger-file (prog-name challenger-prog) hill-dir)))))
+ (let* ((new-scores (append (score-challenger-matches spec challenger-prog hill-progs)
+ scores))
+ (rankings (scores->rankings new-scores)))
+ (if (<= (length rankings) (spec-hill-size spec))
+ (begin
+ (save-scores new-scores hill-dir)
+ (hill-add-file challenger-file (prog-name challenger-prog) hill-dir))
+ (let ((loser (caar rankings)))
+ (save-scores (filter (lambda (score)
+ (not (or (equal? (car score) loser)
+ (equal? (cadr score) loser))))
+ new-scores)
+ hill-dir)
+ (hill-remove loser hill-dir)))))))