Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
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
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 meditating upon the Monastery: (4)
As of 2020-10-22 06:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (225 votes). Check out past polls.

    Notices?