Conway’s game of life


Author Message
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4048
Posted: 07:21pm 27 Apr 2020      

  Turbo46 said  
  Quote  On most computers integer operations are faster than floating point operations

I believe that on the 'Mites that integers can even be slower because floating point calculations use the on-board floating point processor.


Integer calculations being slower seems highly unlikely, as I understand it the reason there isn't also an on-board integer processor is you don't need one, it's only floating points that require the extra support. Aside: if I remember correctly Intel processors (386/486) came with SX and DX variants, the DX variant included the floating point support, and the SX did not. However both were manufactured as the same IC and then the FP unit on the SX versions were mechanically "damaged".

  Turbo46 said  I deliberately didn't use integers because I was aiming for a Maximite version.


A good reason.

  Turbo46 said  
  Quote  You could try making the matrix toroidal by having the right hand side consider cells on the left hand side to be adjacent, and vice-versa. Same for top and bottom. You'll lose some performance but it makes smaller matrices more interesting; I will be doing it for my 16x16 LED matrix.

Whoosh! that went straight over my head. Coffee won't help with that one.


From Wikipedia: "A more sophisticated trick is to consider the left and right edges of the field to be stitched together, and the top and bottom edges also, yielding a toroidal array. The result is that active areas that move across a field edge reappear at the opposite edge."

Basically if you have this array:
A B C D E
F G H I J
K L M N O
P Q R S T


Instead of treating it as having a border of dead cells:
X X X X X X X
X A B C D E X
X F G H I J X
X K L M N O X
X P Q R S T X
X X X X X X X


You pretend you are looking at a window of a larger array that extends and repeats infinitely:
    . . . . . . . . . .
    . . . . . . . . . .
    . . . . . . . . . .
... A B C D E A B C D E ...
... F G H I J F G H I J ...
... K L M N O K L M N O ...
... P Q R S T P Q R S T ...
... A B C D E A B C D E ...
... F G H I J F G H I J ...
... K L M N O K L M N O ...
... P Q R S T P Q R S T ...
    . . . . . . . . . .
    . . . . . . . . . .
    . . . . . . . . . .

Now when considering adjacencies A is considered to be next to 8 potentially "live "cells T, P, Q, E, B, J, F and G instead of 5 of the cells it is next to always being "dead".

Best wishes,

Tom