Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^2: My Conway's Game Of Life Attempt

by ikegami (Patriarch)
on Jan 05, 2010 at 03:28 UTC ( #815684=note: print w/replies, xml ) Need Help??


in reply to Re: My Conway's Game Of Life Attempt
in thread My Conway's Game Of Life Attempt

The intent of the substr pair would be clearer as:
substr($new_world->[$y], $x, 1) = ( $n == 3 ? '0' : ' ' );

Replies are listed 'Best First'.
Re^3: My Conway's Game Of Life Attempt
by eric256 (Parson) on Jan 05, 2010 at 14:15 UTC

    Wouldn't that kill the cell if its $n == 2 and its alive? Basicaly if its $n==2 then the cell remains alive or dead, whichever it was already, dies if its $n<2 or $n>3, and becomes alive if $n==3.


    ___________
    Eric Hodges
      See what I mean by the original being unclear, I misunderstood what it did :)
        to sum the rules up: less than 2 neighbours: dead in the next turn 2 neighbours: unchanged (dead or alive) in the next turn 3 neighbours: becomes/stayes alive in the next turn more than 3 neighbours: dead in the next turn

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://815684]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (1)
As of 2023-06-04 10:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you go to conferences?






    Results (20 votes). Check out past polls.

    Notices?