(period-irx (irregex "^\\."))
(redcode-irx (irregex "^;redcode\n"))
(name-start-irx (irregex "^;[ \t]*name "))
- (name-irx (irregex "^[a-zA-Z0-9]+"))
+ (name-irx (irregex "^[^\n]*"))
(author-start-irx (irregex "^;[ \t]*author "))
(author-irx (irregex "^[^\n]*"))
(comment-irx (irregex "^(;[^\n]*)?\n"))
(instruction-line)))
(define (name-line)
(if (accept-token name-start-irx)
- (cons 'name (string->symbol (accept-token name-irx #t)))
+ (cons 'name (string-trim (accept-token name-irx #t)))
#f))
(define (author-line)
(if (accept-token author-start-irx)
(colors-left colors))
(if (null? progs-left)
entries
- (let ((this-prog (car progs-left))
- (this-col (car colors-left)))
- (loop (cons (cons (prog-name this-prog) this-col) entries)
- (cdr progs-left)
- (cdr colors-left))))))
+ (if (null? colors-left)
+ (error "Not enough colours in colour map!")
+ (let ((this-prog (car progs-left))
+ (this-col (car colors-left)))
+ (loop (cons (cons (prog-name this-prog) this-col) entries)
+ (cdr progs-left)
+ (cdr colors-left)))))))
(define (mars-runner files iters core-size visualization)
(print "Iters: " iters ", core size: " core-size)
(unless (null? remaining-palette)
(let ((name (caar remaining-palette))
(col (cdar remaining-palette)))
- (wish% "label .fb.l" name " -text " name " -fg " col)
- (wish% "pack .fb.l" name " -side left"))
+ (wish% "label .fb.l" col " -text \"" name "\" -fg " col)
+ (wish% "pack .fb.l" col " -side left"))
(loop (cdr remaining-palette))))
(wish% "frame .fc -relief sunken -borderwidth 2")
(wish% "pack .fc -side bottom")