53 lines
1.6 KiB
Plaintext
53 lines
1.6 KiB
Plaintext
{{omit from|GUISS}}
|
|
|
|
[[wp:Wireworld|Wireworld]] is a cellular automaton with some similarities to [[Conway's Game of Life]].
|
|
|
|
It is capable of doing sophisticated computations with appropriate programs
|
|
(it is actually [[wp:Turing-complete|Turing complete]]),
|
|
and is much simpler to program for.
|
|
|
|
A Wireworld arena consists of a Cartesian grid of cells,
|
|
each of which can be in one of four states.
|
|
All cell transitions happen simultaneously.
|
|
|
|
The cell transition rules are this:
|
|
{| class=wikitable
|
|
|-
|
|
! Input State
|
|
! Output State
|
|
! Condition
|
|
|-
|
|
| <tt>empty</tt>
|
|
| <tt>empty</tt>
|
|
|
|
|
|-
|
|
| <tt>electron head </tt>
|
|
| <tt>electron tail </tt>
|
|
|
|
|
|-
|
|
| <tt>electron tail </tt>
|
|
| <tt>conductor</tt>
|
|
|
|
|
|-
|
|
| valign=top | <tt>conductor</tt>
|
|
| valign=top | <tt>electron head </tt>
|
|
| if 1 or 2 cells in the [[wp:Moore neighborhood|neighborhood]] of the cell are in the state “<tt>electron head</tt>”
|
|
|-
|
|
| <tt>conductor</tt>
|
|
| <tt>conductor</tt>
|
|
| otherwise
|
|
|}
|
|
|
|
|
|
;Task:
|
|
Create a program that reads a Wireworld program from a file and displays an animation of the processing. Here is a sample description file (using "<tt>H</tt>" for an electron head, "<tt>t</tt>" for a tail, "<tt>.</tt>" for a conductor and a space for empty) you may wish to test with, which demonstrates two cycle-3 generators and an inhibit gate:
|
|
<pre>
|
|
tH.........
|
|
. .
|
|
...
|
|
. .
|
|
Ht.. ......
|
|
</pre>
|
|
While text-only implementations of this task are possible, mapping cells to pixels is advisable if you wish to be able to display large designs. The logic is not significantly more complex.
|
|
<br><br>
|