fix visited

This commit is contained in:
xenia 2021-06-10 06:12:24 -04:00
parent fc14f5ee76
commit d727e41a07
1 changed files with 4 additions and 1 deletions

View File

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