Wolfram Function Repository
Instantuse addon functions for the Wolfram Language
Function Repository Resource:
Create fractals by random partial jumps toward reference points
ResourceFunction["GeneralizedChaosGame"][reg,n] plots a fractal by iteratively jumping n times toward a random point inside the reference geometry reg by jumping halfway. 

ResourceFunction["GeneralizedChaosGame"][reg,n,jspec] uses the jumping specification jspec. 

ResourceFunction["GeneralizedChaosGame"][reg,n,jspec,format] formats the result according to the output specification format. 
Create the classic Sierpinski triangle using 30000 iterations:
In[1]:= 

Out[1]= 

Jump only 40% of the way towards the reference points:
In[2]:= 

Out[2]= 

Jump between four corners of a trapezoid:
In[3]:= 

Out[3]= 

Jump between random points on a circle:
In[4]:= 

Out[4]= 

Give the geometry as a list of points:
In[5]:= 

Out[5]= 

The reference geometry can be any region, e.g. a Line:
In[6]:= 

Out[6]= 

Perform the chaos game in higher dimensions:
In[7]:= 

Out[8]= 

Combine different regions using RegionUnion:
In[9]:= 

Out[9]= 

The default jump specification is Scaled[0.5]:
In[10]:= 

Out[10]= 

In[11]:= 

Out[11]= 

Perform the chaos game using a 40% jump:
In[12]:= 

Out[12]= 

Perform the chaos game using a jump with a distance of 0.7:
In[13]:= 

Out[13]= 

Alternating between a fractional and a distance jump to create a blurry Sierpinski triangle:
In[14]:= 

Out[14]= 

Alternate between a fractional and a distance jump creates a different result as compared to the individual specifications:
In[15]:= 

Out[15]= 

Jump 50%, 60% or 40% if the last reference point was point 1, 2 or 3, respectively:
In[16]:= 

Out[16]= 

Jump 50%, 60% or 40% if the next reference point is point 1, 2 or 3, respectively:
In[17]:= 

Out[17]= 

Jump halfway towards each point, except for the top one, jump distance 1.75 then:
In[18]:= 

Out[18]= 

Use a pure function to get a combination of fractional and distance jumping:
In[19]:= 

Out[19]= 

Use more complicated functions:
In[20]:= 

Out[20]= 

In[21]:= 

Out[21]= 

The default is a graphical output:
In[22]:= 

Out[22]= 

Obtain the results as a list and perform an operation on it:
In[23]:= 

Out[24]= 

Change the style of the points:
In[25]:= 

Out[25]= 

Change the style of the reference geometry:
In[26]:= 

Out[26]= 

In[27]:= 

Out[27]= 

Change the probability to jump to each reference points:
In[28]:= 

Out[28]= 

Restrict certain landing locations:
In[29]:= 

Out[29]= 

Restrict the point to fall in a circle at the top:
In[30]:= 

Out[30]= 

Allow to only jump 1, 3 or 4 reference points ahead as compared to the last reference point:
In[31]:= 

Out[31]= 

Allow to only jump to points 2, 3 or 4:
In[32]:= 

Out[32]= 

Make the choices depend on its history. Do not allow to jump 1 ahead from the last reference point and 3 ahead from the penultimate reference point:
In[33]:= 

Out[33]= 

Make the choices depend on the last visited reference point:
In[34]:= 

Out[34]= 

Explore jumping in different dimensions. Calculate the jumping in (hyper)spheres in 2D–8D, and then plot the histogram of the distance from the center:
In[35]:= 

Out[35]= 

In[36]:= 

Out[37]= 

Produce the Sierpinski triangle as in a rule 90 cellular automaton:
In[38]:= 

Out[38]= 

In[39]:= 

Out[39]= 

The reference geometry might occlude all the points:
In[40]:= 

Out[40]= 

Use the option ReferenceGeometryStyle to make the points visible:
In[41]:= 

Out[41]= 

For a onedimensional chaos game, explicit braces are needed:
In[42]:= 

Out[42]= 

In[43]:= 

Out[43]= 

For each possible choice, there should be at least one element of True:
In[44]:= 

Out[44]= 

The "Choices" option cannot be used when the region is not points:
In[45]:= 

Out[45]= 

The “Probabilities” option can not be used when the region is not points:
In[46]:= 

Out[46]= 

Recreate the Barnsley fern:
In[47]:= 

Out[48]= 

Jump halfway and jump a distance 0.2 in the perpendicular direction:
In[49]:= 

Out[49]= 

Exclude a wolfshaped portion of the domain results in a fractal of wolves:
In[50]:= 

Out[51]= 

Perform a halfway step and a perpendicular step of 0.1:
In[52]:= 

Out[52]= 

Perform a halfway step and a scaled perpendicular step:
In[53]:= 

Out[53]= 

Wolfram Language 11.3 (March 2018) or above
This work is licensed under a Creative Commons Attribution 4.0 International License