svn: r12487
This commit is contained in:
parent
e0ac6dd80f
commit
2b17f505e5
|
@ -1,14 +1,9 @@
|
||||||
#|
|
;; constants
|
||||||
|
|
||||||
hint: include the size of the board in your world structure
|
|
||||||
This enables you to make test cases with different size boards,
|
|
||||||
making some of the test cases much easier to manage.
|
|
||||||
|
|
||||||
|#
|
|
||||||
|
|
||||||
(define circle-radius 20)
|
(define circle-radius 20)
|
||||||
(define circle-spacing 22)
|
(define circle-spacing 22)
|
||||||
|
|
||||||
|
;; data definitions
|
||||||
|
|
||||||
;; a world is:
|
;; a world is:
|
||||||
;; (make-world board posn state number)
|
;; (make-world board posn state number)
|
||||||
(define-struct world (board cat state size))
|
(define-struct world (board cat state size))
|
||||||
|
@ -138,21 +133,20 @@ making some of the test cases much easier to manage.
|
||||||
|
|
||||||
;; board->image : board number -> image
|
;; board->image : board number -> image
|
||||||
(define (board->image cs world-size)
|
(define (board->image cs world-size)
|
||||||
(foldl overlay
|
(foldl (lambda (x y) (overlay y x))
|
||||||
(nw:rectangle (world-width world-size)
|
(nw:rectangle (world-width world-size)
|
||||||
(world-height world-size)
|
(world-height world-size)
|
||||||
'outline
|
'solid
|
||||||
'black)
|
'white)
|
||||||
(map cell->image cs)))
|
(map cell->image cs)))
|
||||||
|
|
||||||
(check-expect (board->image (list (make-cell (make-posn 0 0) false)) 3)
|
(check-expect (board->image (list (make-cell (make-posn 0 0) false)) 3)
|
||||||
(overlay
|
(overlay
|
||||||
(cell->image
|
|
||||||
(make-cell (make-posn 0 0) false))
|
|
||||||
(nw:rectangle (world-width 3)
|
(nw:rectangle (world-width 3)
|
||||||
(world-height 3)
|
(world-height 3)
|
||||||
'outline
|
'solid
|
||||||
'black)))
|
'white)
|
||||||
|
(cell->image (make-cell (make-posn 0 0) false))))
|
||||||
|
|
||||||
|
|
||||||
;; cell->image : cell -> image
|
;; cell->image : cell -> image
|
||||||
|
|
Loading…
Reference in New Issue
Block a user