```"Robert Klemme" <bob.news / gmx.net> wrote in message news:<bqnk5c\$245j35\$1 / ID-52924.news.uni-berlin.de>...
> "Josef 'Jupp' SCHUGT" <jupp / gmx.de> schrieb im Newsbeitrag
> news:20031203195953.GA2595@jupp%gmx.de...
> > * Robert Klemme; 2003-12-03, 19:24 UTC:
> > > "Josef 'Jupp' SCHUGT" <jupp / gmx.de> schrieb im Newsbeitrag
> > > news:20031203004859.GC893@jupp%gmx.de...

> > row % size
> > method for dealing with the edges also.
>
> The solution is not as sophisticated as it seems. Simply imagine that
> you number the fields like this (use fixed width font):
>
> <pre>
> : +--+--+--+--+--+--+
> : | 0| 1| 2| 3| 4| 5| +--+--+--+--+--+--+
> : | 6| 7| 8| 9|10|11| +--+--+--+--+--+--+
> : |12|13|14|15|16|17| +--+--+--+--+--+--+
> : |18|19|20|21|22|23| +--+--+--+--+--+--+
> : |24|25|26|27|28|29| +--+--+--+--+--+--+
> : |30|31|32|33|34|35|
> : +--+--+--+--+--+--+
> </pre>
>
> If you now store them one after another going one to the right/left
> when assuming 0 and 5 are neighbors and current position is n results
> in (n +/- 1) modulo 6. For the row the same works - with the only
> difference that the result of the operation must be multiplied by the
> distance of the chunks representing a whole row (6 in this case).

I don't understand what you are saying here.

> Perhaps you should try the following C program:
>
> #include <stdio.h>
> void main() {
>   int i, j, a[3][3] = { 1, 2, 3, 4, 5, 6, 7, 8, 9};
>   for (i = 0; i < 3; i++)
>     for (j = 0; j < 3; j++)
>       printf("a[%d][%d] = %d\n", i, j, a[i][j]);
> }
> Surprise, surprise: That really works (even though the initalization
> at first sight does not make much sense) and results in:
>
> a[0][0] = 1
> a[0][1] = 2
> a[0][2] = 3
> a[1][0] = 4
> a[1][1] = 5
> a[1][2] = 6
> a[2][0] = 7
> a[2][1] = 8
> a[2][2] = 9
>
> In short: C does it that way, too - because it is the most efficient one.
======
I don't understand why you are doing this either, unless
it is just to put the cells a single array of length n**2
(n = row.length = column.length).
==========
I prefer to use the a[i][j] notation to label the cells.
I don't find the (6*i + j) notation useful, especially
what using i = i % 6 and j = j % 6 to make a torus of the board.

My ruby program is (forgive me if you have already seen this,
I posted it somewhere before, I forget where)
this is for the acorn initial condition.

This program works--I have compared its results with another
GOL program I found on the web--LifeLab.
=========

NN = 20 ; N = NN - 1
n_steps = 100

tos = Array.new
tng = Array.new

0.upto(N) { |row|
tos[row] = Array.new(NN, 0)
tng[row] = Array.new(NN, 0)
}

tos[4][4] = tos[5][6] = tos[6][3] = tos[6][4] = 1
tos[6][7] = tos[6][8] = tos[6][9] = 1

0.upto(N) do |row|
print tos[row], "\n"
end
puts

1.upto(n_steps) do |generation|
0.upto(N) do |row|
0.upto(N) do |column|
neighbors = 0
-1.upto(1) do |row_offset|
-1.upto(1) do |column_offset|
unless row_offset == 0 and column_offset == 0
i = (row+row_offset) % NN
j = (column+column_offset) % NN
neighbors += tos[i][j]
end
end
end
if tos[row][column] == 0
tng[row][column] = (neighbors == 3) ? 1 : 0
else
tng[row][column] = (neighbors == 2 or neighbors == 3) ? 1 : 0
end
end
end

0.upto(N) do |row|
0.upto(N) do |column|
tos[row][column] = tng[row][column]
end
print tos[row], "\n"
end
puts
puts generation
puts

0.upto(N) do |row|
0.upto(N) do |column|
print (tos[row][column] == 0 ? ' ' : 'X')
end
puts
end
end
#done

```