Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: 1-D Cellular Automata

by punkcraft (Pilgrim)
on Jun 26, 2002 at 17:37 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2024-04-18 02:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found