From d727e41a07a7bc933da45df066ef5e7be48810aa Mon Sep 17 00:00:00 2001 From: haskal Date: Thu, 10 Jun 2021 06:12:24 -0400 Subject: [PATCH] fix visited --- racket/efi/meow.rkt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/racket/efi/meow.rkt b/racket/efi/meow.rkt index 389c8bf..8005884 100644 --- a/racket/efi/meow.rkt +++ b/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"))