=============================
A hobby implementation of the Memory Array Redcode Simulator (MARS)
-and associated tools for the programming game Corewar. The original
+and associated tools for the programming game, Core War. The original
concept for this game was developed by A. K. Dewdney (see
http://corewar.co.uk/dewdney for copies of the 1984 Scientific
American columns where the idea was first presented).
- Maintaining King of the Hill style tournaments in the spirit of
http://www.koth.org.
+JaRS is still under development, and many aspects have not been fully
+tested. Use at your own risk!
+
Further Details
---------------
(make-instr
make-prog
prog-name
+ prog-author
prog-instrs
prog-offset
prog->string
;;; Executive function
;;
- (define (run-mars core queues steps-left)
- (if (or (<= steps-left 0)
- (null? queues)
- (= (length queues) 1))
- queues
- (let* ((queue (car queues))
- (remaining-queues (cdr queues))
- (ptrs (queue-ptrs queue))
- (new-ptrs (execute-instr core (car ptrs) (queue-owner queue))))
- (if (null? new-ptrs)
- (run-mars core remaining-queues (- steps-left 1))
- (begin
- (queue-set-ptrs! queue (append (cdr ptrs) new-ptrs))
- (run-mars core (append remaining-queues (list queue)) (- steps-left 1)))))))
+ (define (run-mars core queues steps-left . rest)
+ (let ((min-queue-count (if (null? rest) 2 (car rest))))
+ (if (or (<= steps-left 0)
+ (< (length queues) min-queue-count))
+ queues
+ (let* ((queue (car queues))
+ (remaining-queues (cdr queues))
+ (ptrs (queue-ptrs queue))
+ (new-ptrs (execute-instr core (car ptrs) (queue-owner queue))))
+ (if (null? new-ptrs)
+ (run-mars core remaining-queues (- steps-left 1))
+ (begin
+ (queue-set-ptrs! queue (append (cdr ptrs) new-ptrs))
+ (run-mars core (append remaining-queues (list queue)) (- steps-left 1))))))))
(define (execute-instr core ptr name)
;; (print ptr "\t" (core ptr '->string) "\t(" name ")")