SHARE
TWEET

Untitled

a guest Oct 23rd, 2019 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. sub execution {
  2.     my ($quantity, $claws) = @_;
  3.  
  4.     throw Exception('quantity and number of claws must be matched!\n')
  5.         if( $quantity != scalar(@$claws) );
  6.  
  7.     my @list;
  8.     push @list, 1 for( 1 .. $quantity );
  9.  
  10.     my $exec = [];
  11.     my $i = 0;
  12.     while( $i < $quantity ) {
  13.         $exec->[$i] = [];
  14.         for( 0 .. ($quantity-1) ) {
  15.             if( ( $_ < $i) and ( $_ >= ( $i - $claws->[$i]) ) ) {
  16.                 $list[$_] &= 0;
  17.             }
  18.             else {
  19.                 $list[$_] &= 1;
  20.             }
  21.         }
  22.         $i++;
  23.     }
  24.     my $counter = 0;
  25.     $counter += $_ for( @list );
  26.  
  27.     return $counter;
  28. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top