One dimensional cellular automata implementation?
In one interview they asked me for implementation of one dimensional cellular automata  program? But I am not able to performed that? Can someone tell me how to do that? 
How to implement below program:

A one-dimensional cellular automata is an array where each position is either off (.) or on (X). At each time step the contents of each cell are updated using a simple rule such as the following:

* If a cell is off then next time it will be in the same state that the cell to its right is currently at.
* If a cell is on then next time it will be off if both of its neighbors are currently on, otherwise it will stay on.

For example, if you start with


....X

then next time you will have


...XX

and the next two steps will be


..XXX.XX.X

Write a problem that implements and displays this one dimensional cellular automata rule. You can assume that the first and last positions never change their state.


One dimensional cellular automata implementation?
===

In one interview they asked me for implementation of one dimensional cellular automata  program? But I am not able to performed that? Can someone tell me how to do that? 
How to implement below program:

A one-dimensional cellular automata is an array where each position is either off (.) or on (X). At each time step the contents of each cell are updated using a simple rule such as the following:

* If a cell is off then next time it will be in the same state that the cell to its right is currently at.
* If a cell is on then next time it will be off if both of its neighbors are currently on, otherwise it will stay on.

For example, if you start with


....X

then next time you will have


...XX

and the next two steps will be


..XXX.XX.X

Write a problem that implements and displays this one dimensional cellular automata rule. You can assume that the first and last positions never change their state.

