Construct a maze with Etoys
Last updated at 9:26 pm UTC on 18 August 2019
In the project catalog of the Squeakland web site you find a maze constructor project file.

On this page you will learn how Etoys was used build to build a maze.
This will allow you to generate various kinds of mazes.

This page is work in progress. The instructions will are written for the Squeak 5.2 release but they also apply for the Squeak 5.3 release. They still need to be completed.

## How I Made a Maze Constructor

Before starting:

I started out with thinking about a simple algorithm for constructing mazes:

I have a rectangular area (playfield) with a dot on it which may move like a turtle.

1. Move forward a random direction.
2. Check: Is area under empty ?
3. Yes: Draw a line to here and start over with step 1.
4. No: Move back and start over with step 1.

I opened the 'objects' flap and brought out a playfield as the world for my maze.
I adjusted the size of the greenish playfield to have the size I want it to have,

Then I choose an ellipse for the turtle and set the dimensions in a way that it appears as a circle.

I opened a viewer on the ellipse and added a new script and named it moveAndTest.
The ellipse has to choose a direction in a random order, but keep the direction in square angles:

How to get function tiles in Etoys (e.g. random function)
Get the random number tile by clicking on the icon right of the ticking/paused indicator.

And the distance to move:

The ellipse now will move forward in a random direction in steps of distance 20.

Then there was time to do some testing:

First if the ellipse obtrudes, if it goes out of it's playfield,
that is not wanted.

This moves the ellipse back and starts the search for a random direction again.

... more explanations and instructions upcoming .....

Perhaps also of interest:
http://scratch.mit.edu/projects/nevit/684432