Function Repository Resource:

FiniteStateIndicatorIcon

Source Notebook

Give graphics to indicate the state of a finite-state system such as the head of a Turing machine

Contributed by: Wolfram Staff (original content by Stephen Wolfram)

ResourceFunction["FiniteStateIndicatorIcon"][{x,y},{s,stot}]

creates an icon at position {x,y} that indicates state s out of a total of stot states.

Details

This iconography is what RulePlot uses for head states from TuringMachine.

Examples

Basic Examples (1) 

Show icons for the states in a 4-state system:

In[1]:=
Graphics[Table[
  ResourceFunction["FiniteStateIndicatorIcon"][{n, 0}, {n, 4}], {n, 4}]]
Out[1]=

Properties and Relations (2) 

Use FiniteStateIndicatorIcon to emulate RulePlot for a TuringMachine:

In[2]:=
TuringMachineRulePlot[rule_, init_, t_, opts___] := With[{data = TuringMachine[rule, init, t]},
  Show[ArrayPlot[ArrayPad[data[[All, -1]], {{0}, {1}}], ColorRules -> {0 -> White, 1 -> RGBColor[0.977, 0.952, 0.], 2 -> RGBColor[0.965, 0.401, 0.18]}, opts], Graphics[{MapIndexed[
      ResourceFunction[
        "FiniteStateIndicatorIcon"][{#[[1, 2]] + 1/2, Length[data] - First[#2] + 1/2}, {#[[1, 1]], 2}] &, data]}]]]

Compare with the built-in RulePlot:

In[3]:=
{TuringMachineRulePlot[{596440, 2, 3}, {1, {{2, 1, 1}, 0}}, 20, Mesh -> True], RulePlot[TuringMachine[{596440, 2, 3}], {1, {{2, 1, 1}, 0}}, 20, Mesh -> True]}
Out[3]=

Version History

  • 2.1.0 – 13 September 2021
  • 2.0.0 – 15 July 2019
  • 1.0.0 – 14 January 2019

Related Resources

License Information