a commit to show something to stevie
svn: r13692
This commit is contained in:
parent
db5cab09e7
commit
88075e2e50
|
@ -172,7 +172,8 @@ flattens the nested lists and the
|
||||||
|
|
||||||
@chunk[<empty-board>
|
@chunk[<empty-board>
|
||||||
(define/contract (empty-board board-size)
|
(define/contract (empty-board board-size)
|
||||||
(-> natural-number/c (listof cell?))
|
(-> (and/c natural-number/c odd? (>=/c 3))
|
||||||
|
(listof cell?))
|
||||||
(filter
|
(filter
|
||||||
(not-corner? board-size)
|
(not-corner? board-size)
|
||||||
(apply
|
(apply
|
||||||
|
@ -187,7 +188,9 @@ flattens the nested lists and the
|
||||||
false))))))))
|
false))))))))
|
||||||
|
|
||||||
(define/contract ((not-corner? board-size) c)
|
(define/contract ((not-corner? board-size) c)
|
||||||
(-> natural-number/c (-> cell? boolean?))
|
(-> (and/c natural-number/c odd? (>=/c 3))
|
||||||
|
(-> cell?
|
||||||
|
boolean?))
|
||||||
(not (and (= 0 (posn-x (cell-p c)))
|
(not (and (= 0 (posn-x (cell-p c)))
|
||||||
(or (= 0 (posn-y (cell-p c)))
|
(or (= 0 (posn-y (cell-p c)))
|
||||||
(= (- board-size 1)
|
(= (- board-size 1)
|
||||||
|
@ -221,7 +224,9 @@ cats initial position as the center spot on the board.
|
||||||
|
|
||||||
@chunk[<empty-world>
|
@chunk[<empty-world>
|
||||||
|
|
||||||
(define (empty-world board-size)
|
(define/contract (empty-world board-size)
|
||||||
|
(-> (and/c natural-number/c odd? (>=/c 3))
|
||||||
|
world?)
|
||||||
(make-world (empty-board board-size)
|
(make-world (empty-board board-size)
|
||||||
(make-posn (quotient board-size 2)
|
(make-posn (quotient board-size 2)
|
||||||
(quotient board-size 2))
|
(quotient board-size 2))
|
||||||
|
@ -318,7 +323,11 @@ and that @scheme[posn]'s distance.
|
||||||
|
|
||||||
@chunk[<bfs>
|
@chunk[<bfs>
|
||||||
|
|
||||||
(define (bfs queue dist-table)
|
(define/contract (bfs queue dist-table)
|
||||||
|
(-> (listof (vector/c (or/c 'boundary posn?) natural-number/c))
|
||||||
|
hash?
|
||||||
|
hash?)
|
||||||
|
'neighbors/w-is-a-free-variable-here-and-I-would-like-it-to-have-a-contract-that-appears-here
|
||||||
(cond
|
(cond
|
||||||
[(empty? queue) dist-table]
|
[(empty? queue) dist-table]
|
||||||
[else
|
[else
|
||||||
|
|
Loading…
Reference in New Issue
Block a user