(define s0 '( (w w w) (w 3 w) (w w w) ) ) (define t0 '( (w w w) (w 3 w) (w w w) ) ) (define s1 '( (w w w) (w 4 w) (w 4 w) (w w w) ) ) (define t1 '( (w w w) (w 4 w) (w 4 w) (w w w) ) ) (define s2 '( (w w w w w w w w) (w 0 0 0 0 0 0 w) (w 0 0 0 0 0 0 w) (w 0 w w 0 w 0 w) (w 0 w 0 0 w 0 w) (w 0 w 0 0 w 0 w) (w 0 w w w w 0 w) (w 0 0 0 0 0 0 w) (w 0 0 0 0 0 0 w) (w w w w w w w w) ) ) (define t2 '( (w w w w w w w w) (w 0 0 0 0 0 0 w) (w 0 0 0 0 0 0 w) (w 0 w w 0 w 0 w) (w 0 w 0 0 w 0 w) (w 0 w 0 0 w 0 w) (w 0 w w w w 0 w) (w 0 0 0 0 0 0 w) (w 0 0 0 0 0 0 w) (w w w w w w w w) ) ) (define s3 '( (w w w w w w w w) (w 1 1 1 1 1 1 w) (w 1 1 1 1 1 1 w) (w 1 w w 9 w 1 w) (w 1 w 1 1 w 1 w) (w 1 w 1 1 w 1 w) (w 1 w w w w 1 w) (w 1 1 1 1 1 1 w) (w 1 1 1 1 1 1 w) (w 1 1 1 1 1 1 w) (w 1 1 1 1 1 1 w) (w w w w 1 w 1 w) (w 1 w 1 1 w 1 w) (w 1 w 1 1 w 1 w) (w 1 w w w w 1 w) (w 1 1 w 1 1 1 w) (w 1 1 1 1 w 1 w) (w w w w w w w w) ) ) (define t3 '( (w w w w w w w w) (w 1 1 1 1 1 1 w) (w 1 1 1 1 1 1 w) (w 1 w w 9 w 1 w) (w 1 w 1 1 w 1 w) (w 1 w 1 1 w 1 w) (w 1 w w w w 1 w) (w 1 1 1 1 1 1 w) (w 1 1 1 1 1 1 w) (w 1 1 1 1 1 1 w) (w 1 1 1 1 1 1 w) (w w w w 1 w 1 w) (w 1 w 1 1 w 1 w) (w 1 w 1 1 w 1 w) (w 1 w w w w 1 w) (w 1 1 w 1 1 1 w) (w 1 1 1 1 w 1 w) (w w w w w w w w) ) ) (define s4 '( (w w w w w w w w w w w) (w 0 0 0 0 0 0 0 0 0 w) (w w w w w 0 w w w 0 w) (w w w w w 0 w w w 0 w) (w 0 0 0 0 0 0 0 w 0 w) (w 0 0 0 0 0 w 0 w 0 w) (w w 0 w w 0 w 0 w 0 w) (w w 0 w 0 0 w 0 w 0 w) (w w 0 w w w w 0 w 0 w) (w w 0 0 0 0 0 0 w 0 w) (w w w w w w w w w 0 w) (w w w w w w w w w 0 w) (w w w w w w w w w 0 w) (w w w w w w w w w 0 w) (w 0 0 0 0 0 0 0 0 0 w) (w w w w w w w w w w w) ) ) (define t4 '( (w w w w w w w w w w w) (w 0 0 0 0 0 0 0 0 0 w) (w w w w w 0 w w w 0 w) (w w w w w 0 w w w 0 w) (w 0 0 0 0 0 0 0 w 0 w) (w 0 0 0 0 0 w 0 w 0 w) (w w 0 w w 0 w 0 w 0 w) (w w 0 w 0 0 w 0 w 0 w) (w w 0 w w w w 0 w 0 w) (w w 0 0 0 0 0 0 w 0 w) (w w w w w w w w w 0 w) (w w w w w w w w w 0 w) (w w w w w w w w w 0 w) (w w w w w w w w w 0 w) (w 0 0 0 0 0 0 0 0 0 w) (w w w w w w w w w w w) ) ) (define p0 '( (procedure start (if mark? (get-mark step start turn-180 step turn-180) (put-mark) ) ) (procedure turn-180 (turn-left turn-left) ) ) ) (define p1 '( (procedure start put-mark ) ) ) (define p2 '( (procedure start (if wall? put-mark step) ) ) ) (define p3 '( (procedure start (if wall? put-mark (step start)) ) ) ) (define p4 '( (procedure start (if wall? put-mark (step start turn-left turn-left step turn-left turn-left)) ) ) ) (define p5 '( (procedure start (if wall? (turn-left start turn-left turn-left turn-left) go-and-return) ) (procedure go-and-return (if wall? put-mark (step go-and-return turn-left turn-left step turn-left turn-left)) ) ) ) (define p6 '( (procedure turn-right (turn-left turn-left turn-left)) (procedure start (if wall? (turn-left (if wall? (turn-left (if wall? (turn-left go-and-return turn-right) go-and-return) turn-right) go-and-return) turn-right) go-and-return) ) (procedure go-and-return (if wall? put-mark (step go-and-return turn-left turn-left step turn-left turn-left)) ) ) ) (define p7 '( (procedure start fill-maze) (procedure fill-maze (if mark? () ( put-mark (if wall? () (step fill-maze step-back)) turn-left (if wall? () (step fill-maze step-back)) turn-left turn-left (if wall? () (step fill-maze step-back)) turn-left ) )) (procedure step-back (turn-left turn-left step turn-left turn-left) ) ) ) (define p8 '( (procedure start add-mark-to-maze) (procedure add-mark-to-maze (if mark? (get-mark (if mark? (put-mark) ( put-mark put-mark (if wall? () (step add-mark-to-maze step-back)) turn-left (if wall? () (step add-mark-to-maze step-back)) turn-left turn-left (if wall? () (step add-mark-to-maze step-back)) turn-left get-mark )) ) (put-mark add-mark-to-maze get-mark) )) (procedure step-back (turn-left turn-left step turn-left turn-left) ) ) ) (define p9 '( (procedure start () ) ) ) (define p10 '( (procedure start (go-north go)) (procedure go (if wall? (turn-left go) (step go-north go) ) ) (procedure go-north (if north? () (turn-left go-north)) ) ) ) (define p11 '( (procedure start (turn-north go)) (procedure go (if wall? () (step go) ) ) (procedure turn-north (if north? () (turn-left turn-north)) ) ) ) (newline) ;(simulate `(,s3 (1 1) north) 'start p6 30 100) ;(simulate `(,s3 (1 1) north) 'start p6 30 100) ;(evaluate `(,p0 ,p1 ,p2 ,p3 ,p4 ,p5 ,p6 ,p7 ,p8 ,p9) `(((,s0 (1 1) west) (,t0 (1 1) north)) ((,s1 (1 2) west) (,t1 (1 1) north)) ((,s2 (4 5) west) (,t2 (4 1) north)) ((,s3 (2 9) east) (,t3 (2 4) north))) `(10 9999 999 9999) 999) (evaluate `(,p0 ,p1 ,p2 ,p3 ,p4 ,p5 ,p6 ,p7 ,p8 ,p9 ,p10 ,p11) `(((,s0 (1 1) south) (,t0 (1 1) south)) ((,s1 (1 2) south) (,t1 (1 2) south)) ((,s2 (1 8) south) (,t2 (1 8) south)) ((,s3 (1 16) east) (,t3 (1 16) east)) ((,s4 (2 9) east) (,t4 (2 4) north)) ) `(107 500 9999 9999) 999)