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