Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: 1-D Cellular Automata

by punkcraft (Pilgrim)
on Jun 26, 2002 at 17:37 UTC ( #177450=note: print w/replies, xml ) Need Help??


in reply to 1-D Cellular Automata

I was playing with this with large values for width and height and found that I could get a 5 fold decrease in runtime by replacing the last for loop with this:

for (1..$high) { print "$str\n"; $prev_str = substr($str, -1, 1) . $str . substr($str, 0, 1); $str = ''; for ($i = 0; $i < $wide; $i++) { $str .= $rules{substr($prev_str, $i, 3 )}; } }

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2023-06-11 00:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you go to conferences?






    Results (40 votes). Check out past polls.

    Notices?