two bugs in hangman
svn: r10792
This commit is contained in:
parent
25f675461a
commit
43e815713c
|
@ -205,9 +205,12 @@
|
||||||
;; select-piece! : -> void
|
;; select-piece! : -> void
|
||||||
;; effect: to decrease pieces-left and to pick the next thing to be drawn
|
;; effect: to decrease pieces-left and to pick the next thing to be drawn
|
||||||
(define (select-piece!)
|
(define (select-piece!)
|
||||||
(when (> pieces-left 0)
|
(if (> pieces-left 0)
|
||||||
|
(begin
|
||||||
(set! pieces-left (sub1 pieces-left))
|
(set! pieces-left (sub1 pieces-left))
|
||||||
(vector-ref PARTS pieces-left)))
|
(vector-ref PARTS pieces-left))
|
||||||
|
;; (<= pieces-left 0)
|
||||||
|
(vector-ref PARTS 1)))
|
||||||
;; the-end? : -> boolean
|
;; the-end? : -> boolean
|
||||||
;; to check whether the hangman is complet
|
;; to check whether the hangman is complet
|
||||||
(define (the-end?) (zero? pieces-left))
|
(define (the-end?) (zero? pieces-left))
|
||||||
|
@ -268,7 +271,15 @@
|
||||||
(set! uncover
|
(set! uncover
|
||||||
(lambda (word)
|
(lambda (word)
|
||||||
(apply string-append (map (lambda (x) (format "~a" x)) word))))
|
(apply string-append (map (lambda (x) (format "~a" x)) word))))
|
||||||
(initialize rv dr status))
|
(initialize (lambda (x y z)
|
||||||
|
(define r (rv x y z))
|
||||||
|
(check-result (object-name rv) list? "list of symbols" r)
|
||||||
|
r)
|
||||||
|
(lambda (x)
|
||||||
|
(define r (dr x))
|
||||||
|
(check-result (object-name dr) boolean? "boolean" r)
|
||||||
|
r)
|
||||||
|
status))
|
||||||
|
|
||||||
;; initialize : as it says ...
|
;; initialize : as it says ...
|
||||||
;; the gui, the guess, the picture, the reveal function the draw-next function
|
;; the gui, the guess, the picture, the reveal function the draw-next function
|
||||||
|
|
Loading…
Reference in New Issue
Block a user