fix shootout problems

svn: r10850
This commit is contained in:
Matthew Flatt 2008-07-21 20:01:30 +00:00
parent 5ff75bac42
commit 319c7406a2
2 changed files with 4 additions and 3 deletions

View File

@ -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)

View File

@ -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)))))