PhysSandbox
Classical MechanicsWaves & SoundElectricity & MagnetismOptics & LightGravity & OrbitsLabs
🌙Astronomy & The Sky🌡️Thermodynamics🌍Biophysics, Fluids & Geoscience📐Math Visualization🔧Engineering🧪Chemistry

Related simulators

Continue with similar topics in this category — or all 85 in Math Visualization.

View category →
NewSchool

Fractal Generator

Launch Simulator

Mandelbrot, Julia, Koch snowflake. Zoom infinitely.

NewUniversity / research

Logistic Map Bifurcation

Launch Simulator

x_{n+1}=rx_n(1−x_n): scan r, plot attractors — period doubling to chaos (Feigenbaum cascade).

NewUniversity / research

Lorenz Strange Attractor

Launch Simulator

σ, ρ, β ODEs; sensitive butterfly in (x,z) projection — RK4 trace.

NewUniversity / research

Rössler Attractor

Launch Simulator

RK4 integration of ẋ=−y−z, ẏ=x+ay, ż=b+z(x−c); period-doubling cascade as c grows.

NewUniversity / research

Newton-Raphson Basins in 2D Systems

Launch Simulator

Map Newton basins for nonlinear F(x,y)=0 systems: initial-guess sensitivity, iteration counts, root attraction, and singular-Jacobian failures.

NewUniversity / research

Newton Fractal

Launch Simulator

Basins of attraction for Newton iteration on zⁿ−1 with adjustable relaxation ω.

PhysSandbox

Interactive physics, chemistry, and engineering simulators for students, teachers, and curious minds.

Physics

  • Classical Mechanics
  • Waves & Sound
  • Electricity & Magnetism

Science

  • Optics & Light
  • Gravity & Orbits
  • Astronomy & The Sky

More

  • Thermodynamics
  • Biophysics, Fluids & Geoscience
  • Math Visualization
  • Engineering
  • Chemistry

© 2026 PhysSandbox. Free interactive science simulators.

PrivacyTermsContact
Home/Math Visualization/Chaos Game (Sierpiński)

Chaos Game (Sierpiński)

Random vertex + midpoint walk; the attractor is the Sierpiński gasket — try RGB by vertex.

Run

1800
0.14

Restricted chaos game (vertex–midpoint) converges to the Sierpiński gasket. Try monochrome vs three colors to see the self-similar partition.

Shortcuts

  • •Space / Enter — play / pause
  • •R — reset fractal

Measured values

Total iterations0

About this model

The chaos game is a probabilistic construction of fractal sets using iterated function systems (IFS). Fix three non-collinear vertices of a triangle in the plane. Start from any point inside the triangle (here, the centroid). At each step, choose one vertex uniformly at random and replace the current point by the midpoint between the current point and that vertex. Repeating this affine “halfway toward a vertex” map generates a cloud of points whose closure is the Sierpiński triangle (Sierpiński gasket): a compact fractal of Hausdorff dimension log 3 / log 2 in the ideal limit. Coloring each plotted pixel by the index of the vertex chosen on that step reveals how the attractor partitions into three self-similar copies, each associated with one vertex. The simulator rasterizes the process on a pixel buffer with adjustable ink strength and iteration rate; the outline shows the generating triangle. This is a standard classroom bridge from random processes to deterministic fractal geometry, complementary to algebraic IFS descriptions {f_k(x) = (x + V_k)/2}.

Who it's for: High school through early undergraduate learners exploring fractals, probability, and iterative constructions; anyone comparing Monte Carlo style processes to geometric self-similarity.

Key terms

  • Chaos game
  • Sierpiński triangle
  • Iterated function system (IFS)
  • Affine map
  • Attractor
  • Self-similarity
  • Fractal dimension
  • Midpoint iteration

How it works

Randomized chaos game on a triangle: each step pick a random vertex and move the current point halfway toward it. The long-run cloud fills the Sierpiński triangle (an IFS attractor). Coloring by the chosen vertex shows how the gasket splits into three self-similar pieces.

Key equations

P ← (P + V_k) / 2 , k ∈ {0,1,2} uniform

Frequently asked questions

Why does a purely random rule produce a deterministic shape?
The randomness only chooses which contraction map to apply; each map is a strict contraction of the plane toward a vertex. Almost every infinite sequence of choices visits the attractor densely, so the empirical point cloud reveals the unique nonempty compact invariant set of the three-map IFS—not a fuzzy blob.
Do I need the starting point inside the triangle?
Any starting point in the plane converges visually into the gasket after discarding an initial transient, but points far away take longer to “fold in.” Starting at the centroid avoids an obvious early streak.
What changes if I turn off “color by vertex”?
The same attractor appears, but without the three-way coloring that highlights which map was most recently applied. Monochrome mode emphasizes overall density; color mode emphasizes the self-similar partition.
Is this the same as the random midpoint game on a square?
Four vertices with the same midpoint rule fills the square densely—the attractor is not a thin fractal. The triangle case with three maps is special because the three contractions isolate a Cantor-set-like limit in the standard chaos-game normalization.