Forum: Ruby Help me ruby and shoes

6724fd11282d22ea90a8f2400b5c4878?d=identicon&s=25 Carlo Primo (joker12)
on 2014-06-16 21:12
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.
54404bcac0f45bf1c8e8b827cd9bb709?d=identicon&s=25 7stud -- (7stud)
on 2014-06-17 00:06
Good luck.
6724fd11282d22ea90a8f2400b5c4878?d=identicon&s=25 Carlo Primo (joker12)
on 2014-06-17 07:35
???
6724fd11282d22ea90a8f2400b5c4878?d=identicon&s=25 Carlo Primo (joker12)
on 2014-06-17 14:13
Help me please :'(
B078cb4f4fb473c7a54d1fc36d10c70e?d=identicon&s=25 Regis d'Aubarede (raubarede)
on 2014-06-17 15:42
Carlo Primo wrote in post #1149906:
> Help me please :'(

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

Ok?
4828d528e2e46f7c8160c336eb332836?d=identicon&s=25 Robert Heiler (shevegen)
on 2014-06-18 13:59
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.
6724fd11282d22ea90a8f2400b5c4878?d=identicon&s=25 Carlo Primo (joker12)
on 2014-06-18 14:22
I can t not solve.  Please help.
Is The game of life 1d array.
B078cb4f4fb473c7a54d1fc36d10c70e?d=identicon&s=25 Regis d'Aubarede (raubarede)
on 2014-06-18 16:53
Carlo Primo 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
6724fd11282d22ea90a8f2400b5c4878?d=identicon&s=25 Carlo Primo (joker12)
on 2014-06-18 17:15
this code doesen't work. my exercise use 1d array !
i don't insert the modify to my specific code.
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.