master
Matthew Butterick 5 years ago
parent 70e902c06d
commit 73c7aedc76

@ -74,12 +74,12 @@
[-1 3] [-1 3]
[1 4])) [1 4]))
(require graph)
(define g (unweighted-graph/undirected null))
(define (turn-left dir) (* dir +i)) (define (turn-left dir) (* dir +i))
(define (turn-right dir) (/ dir +i)) (define (turn-right dir) (/ dir +i))
(require graph)
(define g (unweighted-graph/undirected null))
(define (explore loc [dir +i]) (define (explore loc [dir +i])
(define left-dir (turn-left dir)) (define left-dir (turn-left dir))
(match (step (dir->cmd left-dir)) (match (step (dir->cmd left-dir))
@ -89,5 +89,6 @@
['empty (explore (+ loc left-dir) left-dir)] ['empty (explore (+ loc left-dir) left-dir)]
['oxygen (+ loc left-dir)])])) ['oxygen (+ loc left-dir)])]))
(define oxygen-loc (explore 0)) ;; 1
(fewest-vertices-path g 0 oxygen-loc) (check-eq? (sub1 (length (fewest-vertices-path g 0 (explore 0)))) 272)