# Chaos-game

### 1 collaborator

Jesus Marcano (Author)

### Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.2.1-beta1 • Viewed 173 times • Downloaded 1 time • Run 0 times

## WHAT IS IT?

The chaos game is an algorithm first described by Michael Barnsley in 1988. Here's a YouTube video of him describing this game. http://youtu.be/MBhx4XXJOH8

## HOW IT WORKS

Start with a triangle and many dots, then each dot ramdonly chooses a random vertex of the triangle and moves half the distance towards it in every time step. Note, the topology of the world is flat, not a donut.

## HOW TO USE IT

"setup" places the vetices of the triangle and creates many dots all over the world. "go" starts the simulation.

## THINGS TO NOTICE

The emergence of the Sierpinski triangle.

## THINGS TO TRY

Try "watch one-of dots" button.

## EXTENDING THE MODEL

Each dot jumps half the distance to a vertex. We could change that to 1/3 the distance for example.

## NETLOGO FEATURES

I'm using a beta version of NetLogo and it's not breaking! (version 6.2.1-beta1)

## RELATED MODELS

Example of other variations in Mathematica: http://mathworld.wolfram.com/ChaosGame.html

## CREDITS AND REFERENCES

This program uploaded to Modeling Commons.

Click to Run Model

```;; The chaos game
;; j.marcano Oct 8 2021

breed [vertices vertex] ;; these turtles are the vertices of the triangle
breed [dots dot] ;; these are dots that jump around following the game rules

to setup
clear-all
setup-vertices
setup-dots
reset-ticks
end

to go
let this-vertex one-of vertices
face this-vertex
jump (distance this-vertex) / 2]
tick
end

to setup-vertices
set-default-shape vertices "target"
;; ask the patches at the vertices of the triangle to each produce one vertex
ask (patch-set patch -14 14 patch 14 14 patch 0 -14) [sprout-vertices 1]
end

to setup-dots
set-default-shape dots "dot"
;; create a bunch of dots
create-dots 5500 [
setxy random-xcor random-ycor
set size 0.3] ; change the size value here if you can't see them
end
```

There are 2 versions of this model.