Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^6: High Performance Game of Life

by eyepopslikeamosquito (Chancellor)
on Aug 13, 2017 at 05:46 UTC ( #1197326=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    package Organism;
    
    ...
    }
    
    1;
    
  2. or download this
    for my $c (keys %{ $cells }) {
    
  3. or download this
    while ( my ($c) = each %{ $cells } ) {
    
  4. or download this
    sub tick {
       my $self  = shift;
    ...
              + exists($cells->{pack 'i2', $x2, $y2}) == 3 ) } @zcells
       } keys %{$cells};
    }
    
  5. or download this
    sub tick {
       my $self  = shift;
    ...
       } keys %{$cells} } = undef;
       $self->{Cells} = \%newcells;
    }
    
  6. or download this
    my @zcells = (
       ($k1 = pack 'i2', $x1, $y1) x !exists($cells->{$k1}),
    ...
       ($k6 = pack 'i2', $x2, $y1) x !exists($cells->{$k6}),
       ($k7 = pack 'i2', $x2, $y0) x !exists($cells->{$k7}),
       ($k8 = pack 'i2', $x2, $y2) x !exists($cells->{$k8})  );
    
  7. or download this
    my @zcells = grep( !exists($cells->{$_}),
       pack('i2', $x1, $y1),
    ...
       pack('i2', $x2, $y1),
       pack('i2', $x2, $y0),
       pack('i2', $x2, $y2) );
    
  8. or download this
    sub tick {
       my $self  = shift;
    ...
       }
       $self->{Cells} = \%newcells;
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1197326]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2018-01-19 21:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How did you see in the new year?










    Results (223 votes). Check out past polls.

    Notices?