Help me ruby and shoes

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.
thank you!

exercise:

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”)).

Example:
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

100101

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

  1. takes as input a possible initial state of the cellular automaton of
    n elements (n chosen by the user);
  2. displays on the screen the initial state I;
  3. provide a button “Evolve” which allows to compute the next state
    of the automaton and displays it on the screen instead of the
    previous state.

Good luck.

Help me please :’(

Carlo P. wrote in post #1149906:

Help me please :’(

My soon is ok for doing your homework.
He want 3 Nutellas…

Ok?

I can t not solve. Please help.
Is The game of life 1d array.

Carlo P. wrote in post #1150043:

I can t not solve. Please help.

There are a game of life (2D), based on Gtk/Ruiby, ready at :

https://github.com/glurp/dsl-gtk/blob/master/samples/gol.rb

this code doesen’t work. my exercise use 1d array !
i don’t insert the modify to my specific code.

The problem is too complex to solve it all for you.

You should attempt to solve it on your own first, and then ask specific
questions as to what is missing yet.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs