DanielS/Wireworld

Explore the Wireworld Turing-complete cellular automaton

Contributed By: Daniel Sanchez  |  Daniel Sanchez

Wireworld is a Turing-complete cellular automaton first proposed by Brian Silverman in 1987 suited for simulating logic gates and other real-world computer elements.

Installation Instructions

To install this paclet in your Wolfram Language environment, evaluate this code:
PacletInstall[ResourceObject["DanielS/Wireworld"]]

Paclet Guide

Examples

Basic Examples (2) 

Evolve a Wireworld state for 2 steps:

In[1]:=
InterpretationBox[FrameBox[TagBox[TooltipBox[PaneBox[GridBox[List[List[GraphicsBox[List[Thickness[0.006082377284997087`], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[2.78206`, 85.44900000000004`], List[79.17353999999999`, 41.67850000000004`], List[79.17353999999999`, 1.6779000000000508`], List[2.78206`, 45.44840000000002`]], List[List[127.7826`, 115.44898000000003`], List[127.7826`, 26.449000000000012`], List[161.7832`, 47.44780000000006`], List[161.7832`, 135.44923000000003`]], List[List[5.78267`, 141.44910000000004`], List[40.783`, 121.44819000000003`], List[117.7831`, 165.44919000000004`], List[81.37629999999999`, 187.24592000000004`]]]]], List[FaceForm[RGBColor[0.9843139999999999`, 0.662745`, 0.25098000000000004`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[79.20467000000001`, 90.91309000000003`], List[79.20546`, 48.911800000000056`], List[43.782610000000005`, 69.44830000000003`], List[43.782610000000005`, 111.44764000000002`]], List[List[82.77993`, 137.44809000000004`], List[48.77938`, 117.44782000000004`], List[82.77993`, 97.44923000000004`], List[117.7808`, 117.44782000000004`]], List[List[86.41823000000001`, 90.97696000000002`], List[86.45015000000001`, 48.71930000000003`], List[121.7829`, 70.44880000000003`], List[121.7829`, 112.44819000000003`]]]]], List[FaceForm[RGBColor[0.46274499999999996`, 0.066667`, 0.07451`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[158.7825`, 141.44910000000004`], List[123.7817`, 121.44886000000004`], List[89.78278999999999`, 141.44910000000004`], List[123.7817`, 161.44770000000003`]], List[List[2.7817600000000002`, 92.44794000000003`], List[37.782610000000005`, 72.44770000000003`], List[37.782610000000005`, 114.44870000000003`], List[2.7817600000000002`, 134.44898000000003`]], List[List[86.45015000000001`, 1.7736000000000445`], List[121.78269999999999`, 23.44920000000002`], List[121.78269999999999`, 63.33730000000003`], List[86.45015000000001`, 41.66350000000003`]]]]], List[FaceForm[RGBColor[1.`, 0.41568600000000006`, 0.054902000000000006`, 1.`]]], Rule[StripOnInput, False]]], List[Rule[BaselinePosition, Scaled[0.15`]], Rule[ImageSize, 10], Rule[ImageSize, List[30, Automatic]]]], StyleBox[RowBox[List["WireworldEvolve", " "]], Rule[ShowAutoStyles, False], Rule[ShowStringCharacters, False], Rule[FontSize, Times[0.9`, Inherited]], Rule[FontColor, GrayLevel[0.1`]]]]], Rule[GridBoxSpacings, List[Rule["Columns", List[List[0.25`]]]]]], Rule[Alignment, List[Left, Baseline]], Rule[BaselinePosition, Baseline], Rule[FrameMargins, List[List[3, 0], List[0, 0]]], Rule[BaseStyle, List[Rule[LineSpacing, List[0, 0]], Rule[LineBreakWithin, False]]]], RowBox[List["PacletSymbol", "[", RowBox[List["\"DanielS/Wireworld\"", ",", "\"WireworldEvolve\""]], "]"]], Rule[TooltipStyle, List[Rule[ShowAutoStyles, True], Rule[ShowStringCharacters, True]]]], Function[Annotation[Slot[1], Style[Defer[PacletSymbol["DanielS/Wireworld", "WireworldEvolve"]], Rule[ShowStringCharacters, True]], "Tooltip"]]], Rule[Background, RGBColor[0.968`, 0.976`, 0.984`]], Rule[BaselinePosition, Baseline], Rule[DefaultBaseStyle, List[]], Rule[FrameMargins, List[List[0, 0], List[1, 1]]], Rule[FrameStyle, RGBColor[0.831`, 0.847`, 0.85`]], Rule[RoundingRadius, 4]], PacletSymbol["DanielS/Wireworld", "WireworldEvolve"], Rule[Selectable, False], Rule[SelectWithContents, True], Rule[BoxID, "PacletSymbolBox"]][SparseArray[
 Automatic, {5, 11}, 0, {1, {{0, 0, 2, 12, 14, 14}, {{5}, {6}, {1}, {2}, {3}, {4}, {5}, {
    7}, {8}, {9}, {10}, {11}, {5}, {6}}}, {3, 3, 3, 3, 2, 1, 3, 3, 3, 2, 1, 3, 3, 3}}], 2]
Out[1]=

Plot a Wireworld state:

In[2]:=
InterpretationBox[FrameBox[TagBox[TooltipBox[PaneBox[GridBox[List[List[GraphicsBox[List[Thickness[0.006082377284997087`], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[2.78206`, 85.44900000000004`], List[79.17353999999999`, 41.67850000000004`], List[79.17353999999999`, 1.6779000000000508`], List[2.78206`, 45.44840000000002`]], List[List[127.7826`, 115.44898000000003`], List[127.7826`, 26.449000000000012`], List[161.7832`, 47.44780000000006`], List[161.7832`, 135.44923000000003`]], List[List[5.78267`, 141.44910000000004`], List[40.783`, 121.44819000000003`], List[117.7831`, 165.44919000000004`], List[81.37629999999999`, 187.24592000000004`]]]]], List[FaceForm[RGBColor[0.9843139999999999`, 0.662745`, 0.25098000000000004`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[79.20467000000001`, 90.91309000000003`], List[79.20546`, 48.911800000000056`], List[43.782610000000005`, 69.44830000000003`], List[43.782610000000005`, 111.44764000000002`]], List[List[82.77993`, 137.44809000000004`], List[48.77938`, 117.44782000000004`], List[82.77993`, 97.44923000000004`], List[117.7808`, 117.44782000000004`]], List[List[86.41823000000001`, 90.97696000000002`], List[86.45015000000001`, 48.71930000000003`], List[121.7829`, 70.44880000000003`], List[121.7829`, 112.44819000000003`]]]]], List[FaceForm[RGBColor[0.46274499999999996`, 0.066667`, 0.07451`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[158.7825`, 141.44910000000004`], List[123.7817`, 121.44886000000004`], List[89.78278999999999`, 141.44910000000004`], List[123.7817`, 161.44770000000003`]], List[List[2.7817600000000002`, 92.44794000000003`], List[37.782610000000005`, 72.44770000000003`], List[37.782610000000005`, 114.44870000000003`], List[2.7817600000000002`, 134.44898000000003`]], List[List[86.45015000000001`, 1.7736000000000445`], List[121.78269999999999`, 23.44920000000002`], List[121.78269999999999`, 63.33730000000003`], List[86.45015000000001`, 41.66350000000003`]]]]], List[FaceForm[RGBColor[1.`, 0.41568600000000006`, 0.054902000000000006`, 1.`]]], Rule[StripOnInput, False]]], List[Rule[BaselinePosition, Scaled[0.15`]], Rule[ImageSize, 10], Rule[ImageSize, List[30, Automatic]]]], StyleBox[RowBox[List["WireworldPlot", " "]], Rule[ShowAutoStyles, False], Rule[ShowStringCharacters, False], Rule[FontSize, Times[0.9`, Inherited]], Rule[FontColor, GrayLevel[0.1`]]]]], Rule[GridBoxSpacings, List[Rule["Columns", List[List[0.25`]]]]]], Rule[Alignment, List[Left, Baseline]], Rule[BaselinePosition, Baseline], Rule[FrameMargins, List[List[3, 0], List[0, 0]]], Rule[BaseStyle, List[Rule[LineSpacing, List[0, 0]], Rule[LineBreakWithin, False]]]], RowBox[List["PacletSymbol", "[", RowBox[List["\"DanielS/Wireworld\"", ",", "\"WireworldPlot\""]], "]"]], Rule[TooltipStyle, List[Rule[ShowAutoStyles, True], Rule[ShowStringCharacters, True]]]], Function[Annotation[Slot[1], Style[Defer[PacletSymbol["DanielS/Wireworld", "WireworldPlot"]], Rule[ShowStringCharacters, True]], "Tooltip"]]], Rule[Background, RGBColor[0.968`, 0.976`, 0.984`]], Rule[BaselinePosition, Baseline], Rule[DefaultBaseStyle, List[]], Rule[FrameMargins, List[List[0, 0], List[1, 1]]], Rule[FrameStyle, RGBColor[0.831`, 0.847`, 0.85`]], Rule[RoundingRadius, 4]], PacletSymbol["DanielS/Wireworld", "WireworldPlot"], Rule[Selectable, False], Rule[SelectWithContents, True], Rule[BoxID, "PacletSymbolBox"]][SparseArray[
 Automatic, {13, 24}, 0, {1, {{0, 0, 0, 8, 15, 24, 28, 34, 38, 47, 54, 62, 62, 62}, {{
    4}, {5}, {6}, {7}, {8}, {9}, {10}, {11}, {3}, {12}, {13}, {14}, {
    15}, {16}, {17}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11}, {18}, {
    17}, {18}, {19}, {20}, {17}, {20}, {21}, {22}, {23}, {24}, {17}, {
    18}, {19}, {20}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11}, {18}, {
    3}, {12}, {13}, {14}, {15}, {16}, {17}, {4}, {5}, {6}, {7}, {8}, {
    9}, {10}, {11}}}, {3, 3, 3, 3, 3, 3, 2, 1, 3, 3, 3, 3, 3, 2, 1, 3,
    3, 3, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 1, 3, 3, 3, 3, 3, 2, 1, 3, 3, 3, 3, 2, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}}]]
Out[2]=

Scope (2) 

Test whether a matrix is a valid Wireworld state:

In[3]:=
InterpretationBox[FrameBox[TagBox[TooltipBox[PaneBox[GridBox[List[List[GraphicsBox[List[Thickness[0.006082377284997087`], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[2.78206`, 85.44900000000004`], List[79.17353999999999`, 41.67850000000004`], List[79.17353999999999`, 1.6779000000000508`], List[2.78206`, 45.44840000000002`]], List[List[127.7826`, 115.44898000000003`], List[127.7826`, 26.449000000000012`], List[161.7832`, 47.44780000000006`], List[161.7832`, 135.44923000000003`]], List[List[5.78267`, 141.44910000000004`], List[40.783`, 121.44819000000003`], List[117.7831`, 165.44919000000004`], List[81.37629999999999`, 187.24592000000004`]]]]], List[FaceForm[RGBColor[0.9843139999999999`, 0.662745`, 0.25098000000000004`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[79.20467000000001`, 90.91309000000003`], List[79.20546`, 48.911800000000056`], List[43.782610000000005`, 69.44830000000003`], List[43.782610000000005`, 111.44764000000002`]], List[List[82.77993`, 137.44809000000004`], List[48.77938`, 117.44782000000004`], List[82.77993`, 97.44923000000004`], List[117.7808`, 117.44782000000004`]], List[List[86.41823000000001`, 90.97696000000002`], List[86.45015000000001`, 48.71930000000003`], List[121.7829`, 70.44880000000003`], List[121.7829`, 112.44819000000003`]]]]], List[FaceForm[RGBColor[0.46274499999999996`, 0.066667`, 0.07451`, 1.`]]], Rule[StripOnInput, False]], StyleBox[List[FilledCurveBox[List[List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]], List[List[0, 2, 0], List[0, 1, 0], List[0, 1, 0]]], List[List[List[158.7825`, 141.44910000000004`], List[123.7817`, 121.44886000000004`], List[89.78278999999999`, 141.44910000000004`], List[123.7817`, 161.44770000000003`]], List[List[2.7817600000000002`, 92.44794000000003`], List[37.782610000000005`, 72.44770000000003`], List[37.782610000000005`, 114.44870000000003`], List[2.7817600000000002`, 134.44898000000003`]], List[List[86.45015000000001`, 1.7736000000000445`], List[121.78269999999999`, 23.44920000000002`], List[121.78269999999999`, 63.33730000000003`], List[86.45015000000001`, 41.66350000000003`]]]]], List[FaceForm[RGBColor[1.`, 0.41568600000000006`, 0.054902000000000006`, 1.`]]], Rule[StripOnInput, False]]], List[Rule[BaselinePosition, Scaled[0.15`]], Rule[ImageSize, 10], Rule[ImageSize, List[30, Automatic]]]], StyleBox[RowBox[List["WireworldStateQ", " "]], Rule[ShowAutoStyles, False], Rule[ShowStringCharacters, False], Rule[FontSize, Times[0.9`, Inherited]], Rule[FontColor, GrayLevel[0.1`]]]]], Rule[GridBoxSpacings, List[Rule["Columns", List[List[0.25`]]]]]], Rule[Alignment, List[Left, Baseline]], Rule[BaselinePosition, Baseline], Rule[FrameMargins, List[List[3, 0], List[0, 0]]], Rule[BaseStyle, List[Rule[LineSpacing, List[0, 0]], Rule[LineBreakWithin, False]]]], RowBox[List["PacletSymbol", "[", RowBox[List["\"DanielS/Wireworld\"", ",", "\"WireworldStateQ\""]], "]"]], Rule[TooltipStyle, List[Rule[ShowAutoStyles, True], Rule[ShowStringCharacters, True]]]], Function[Annotation[Slot[1], Style[Defer[PacletSymbol["DanielS/Wireworld", "WireworldStateQ"]], Rule[ShowStringCharacters, True]], "Tooltip"]]], Rule[Background, RGBColor[0.968`, 0.976`, 0.984`]], Rule[BaselinePosition, Baseline], Rule[DefaultBaseStyle, List[]], Rule[FrameMargins, List[List[0, 0], List[1, 1]]], Rule[FrameStyle, RGBColor[0.831`, 0.847`, 0.85`]], Rule[RoundingRadius, 4]], PacletSymbol["DanielS/Wireworld", "WireworldStateQ"], Rule[Selectable, False], Rule[SelectWithContents, True], Rule[BoxID, "PacletSymbolBox"]][SparseArray[
 Automatic, {3, 10}, 0, {1, {{0, 5, 10, 15}, {{6}, {7}, {8}, {9}, {10}, {1}, {2}, {3}, {
    4}, {5}, {6}, {7}, {8}, {9}, {10}}}, {1, 3, 3, 3, 3, 3, 3, 3, 3, 2, 1, 3, 3, 3, 3}}]]
Out[3]=

Open a window and draw/edit a Wireworld state:

Interactive Examples (2) 

Animate the evolution of an OR gate fed by two electron sources:

In[4]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/b03a4b56-789e-4be3-b26c-fb6a915c9190"]
Out[4]=

Animate the behaviour of an OR gate, an XOR gate and an inverter:

In[5]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/0f27477c-3880-4865-a03e-268e4dd7fb93"]
Out[5]=

Resource History

Paclet Source

Source Metadata