Skip to content

Welcome Sites Tools Teacher guide Help
  You are not logged in Join

Log in

Chase, avoid, and random

Created by Ken   -   Topic Group: Models Systems and Randomness   -   Created: 02-12-04   -   Modified: 03-05-05




This is a little demonstration of a set of animal gadgets for movement. The only active thing in this demo is the blue rectangle that sends out sensory probes regularly and then moves towards a goal for a while and then switches to a new goal if there is one.

Blue moves towards dark green rectangles at a speed of 100. Blue dislikes dark red and moves away from them at a speed of 200. Sometimes it selects a random goal and moves towards it at speed of 50. Every 6 seconds blue switches goals if there is a new one. If there are many new ones it switches the most recent one.

Probes are visible for demonstration/debugging purposes they had a similar colour to the object they are searching for. They last 2 seconds. One is stationary and other other moves a bit.

How this works

The blue rectangle has 4 animal gadgets on the back:

  1. Goal tracker. This switches to a new goal (if one has been delivered by a bird) every 5 seconds (easy to change). It moves towards its goal with separately specified horizontal and vertical speeds. The speeds can be negative to avoid something. The object being tracked (or avoided) can be moving and this behaviour will adjust accordingly.
  2. Positive probe. Sends out a probe that lasts 6 seconds (easy to change). You can control what the probe is looking for (here it is green rectangles) and what speed it'll move towards what it finds. Note that a probe can optionally move while it is searching for something.
  3. Negative probe. Similar to a positive problem but uses negative speeds so it moves away from any object it finds.
  4. Random goal generator. Sends out a new random goal every 6 seconds.

Note this requires 3.128 or later to run properly.