# Chaos-game

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)

## 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.

## Comments and Questions

;; 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 ask dots [ 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.

## Attached files

File | Type | Description | Last updated | |
---|---|---|---|---|

Chaos-game.png | preview | Preview for 'Chaos-game' | almost 3 years ago, by Jesus Marcano | Download |

This model does not have any ancestors.

This model does not have any descendants.