Logo Maze Crawlers.

A maze crawler is an autonomous program which navigates its way through a maze. For the purposes of this challenge the maze is a bitmap loaded from the W: drive. The maze starts on a red shape and ends on a green one. The sides of the maze are black. The crawler must not drive onto a black pixel.

Your challenge is to program crawlers which can tackle different kinds of maze by the shortest route possible.

Basic Maze Crawler

This program demonstrates the basic commands needed to solve a maze in Logo on a bitmap.

Setup

to setup
cs ht
pu setxy -250 -150 pd
bitload "W:\\logogame\\prac1.bmp
pu setxy -210 200 pd
end

randwalk

to randwalk
make "distance 0
do.until [
setpencolor [255 000 000]
rt random 360
wait 2
do.until [
fd 1
make "distance :distance+1
][0 = item 1 pixel];end of inner loop
if not(255=item 2 pixel)[
setpencolor [000 000 000]
back 1]
][255=item 2 pixel]; end of outer loop
show "distance
show :distance
end

setup clears the screen, draws the bitmap at (-250, -150) and then positions the turtle inside the red blob.

Logo has a bitload command for loading bitmaps and a gifload command for loading gifs (in more recent versions).

randwalk uses a pair of nested do.until loops. The outside loop stops when the turtle lands on a green pixel. The inner loop stops when the turtle lands on a black pixel. At this point the turtle backs away from the black wall and then heads off in a random direction. Colours are read using the pixel command.

This is a very poor program. The practice maze W:logogame/prac1.bmp has a tunnel which is at most 1000 pixels long but randwalk can take tens of thousands of pixels to solve it. randwalk will however solve any 2-D maze, eventually.

At the start.

A little later.

Success after 65000 pixels.

Training Mazes Type 1

These have no branches, dead ends or loops.

W:logogame\prac1.gif


W:logogame\prac2.gif


W:logogame\prac3.gif

Training Mazes Type 2

These have branches and dead ends but no loops.

W:logogame\prac4.gif


Training Mazes Type 3

These have branches, dead ends and loops.

W:logogame\prac5.gif


Practice Mazes