fix shootout problems
svn: r10850
This commit is contained in:
parent
5ff75bac42
commit
319c7406a2
|
@ -47,6 +47,7 @@
|
||||||
(match (channel-get ch)
|
(match (channel-get ch)
|
||||||
[(cons other-color other-name)
|
[(cons other-color other-name)
|
||||||
;; Meet:
|
;; Meet:
|
||||||
|
(sleep) ; avoid imbalance from weak fairness
|
||||||
(loop (change color other-color)
|
(loop (change color other-color)
|
||||||
(add1 met)
|
(add1 met)
|
||||||
(+ same (if (eq? name other-name)
|
(+ same (if (eq? name other-name)
|
||||||
|
|
|
@ -215,14 +215,14 @@
|
||||||
(set! to-go (- to-go 2)))))
|
(set! to-go (- to-go 2)))))
|
||||||
|
|
||||||
(define (print-solution solution)
|
(define (print-solution solution)
|
||||||
(newline)
|
|
||||||
(for ([y (in-range height)])
|
(for ([y (in-range height)])
|
||||||
(for ([x (in-range width)])
|
(for ([x (in-range width)])
|
||||||
(display (string-ref solution (+ x (* y width))))
|
(display (string-ref solution (+ x (* y width))))
|
||||||
(display " "))
|
(display " "))
|
||||||
(display "\n")
|
(display "\n")
|
||||||
(when (even? y)
|
(when (even? y)
|
||||||
(display " "))))
|
(display " ")))
|
||||||
|
(newline))
|
||||||
|
|
||||||
(define (solve! n)
|
(define (solve! n)
|
||||||
(set! to-go n)
|
(set! to-go n)
|
||||||
|
@ -230,6 +230,6 @@
|
||||||
|
|
||||||
(command-line #:args (n) (solve! (string->number n)))
|
(command-line #:args (n) (solve! (string->number n)))
|
||||||
(let ([solutions (sort solutions string<?)])
|
(let ([solutions (sort solutions string<?)])
|
||||||
(printf "~a solutions found\n" (length solutions))
|
(printf "~a solutions found\n\n" (length solutions))
|
||||||
(print-solution (car solutions))
|
(print-solution (car solutions))
|
||||||
(print-solution (list-ref solutions (sub1 (length solutions)))))
|
(print-solution (list-ref solutions (sub1 (length solutions)))))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user