Browse Source

fix visited

gist
haskal 3 months ago
parent
commit
d727e41a07
  1. 5
      racket/efi/meow.rkt

5
racket/efi/meow.rkt

@ -26,8 +26,10 @@
#:init (or (and (item? $v) (set-member? held (item-name $v)))
(conj? $v)
(and (requirement? $v) (empty? (get-neighbors G $v)))))
(define-vertex-property G visited? #:init #f)
(do-dfs G
#:visit?: #t
#:prologue: (visited?-set! $to #t)
#:visit?: (not (visited? $to))
#:epilogue: (cond
[(and (conj? $from) (not (attainable? $to)))
(attainable?-set! $from #f)]
@ -39,6 +41,7 @@
(define requirements
(hash "a" (list (list "apples" "bananas" "meows") (list "bananas") (list "c"))
"b" '()
"d" (list (list "apples" "d"))
"c" (list (list "apples" "meows"))))
(define held (set "apples" "bananas" "clementines"))

Loading…
Cancel
Save