hello to everybody. I have a problem with an exercise and ruby shoes and
I would like to kindly ask for your help. I can not solve the problem.
A cellular automaton is a mathematical model used to describe the
evolution of complex discrete systems.
A one-dimensional cellular automaton consists of an array of n cells.
The array can have any dimension n over. Each of these cells can take on
a finite set of states (for example, 1 (“live”) or 0 (“dead”)).
The array below represents a configuration of a cellular automaton that
contains two cells alive and five dead.
1 0 1 0 0 0 0
At a certain time t = 0 is assigned to each cell in a given state. The
set of these states is the initial state of the cellular automaton.
After a predetermined time each cell will change state at the same time
to all the other, according to the following transition rule:
rule 111 110 101 100 011 010 001 000
new state for center cell 0 1 1 0 1 1 1 0
The way in which it changes state from a cell depends only on its
current state and
the states of the two adjacent cells.
For example, starting from the initial state at time t = 0
applying the rule given the automaton evolves in the state
101111 (time t = 1)
and such was the automaton evolves in
111001 (time t = 2)
Note that the first and the last element of the array never change,
because of these elements, the transition rule is not applicable.
In fact, in order to apply the rule to a
element x is necessary to know the value of the two adjacent elements
x-1 and x +1, and in the case of the first and the last element of the
array, we have only one adjacent element.
Shoes to write an application that
- takes as input a possible initial state of the cellular automaton of
n elements (n chosen by the user);
- displays on the screen the initial state I;
- provide a button “Evolve” which allows to compute the next state
of the automaton and displays it on the screen instead of the