Untitled

Run Settings
LanguageRaku
Language Version
Run Command
#!/usr/bin/env perl6 my constant RabbitPair = Int; my RabbitPair @pairs.push: 0; sub MAIN( Int :$months where $_ < 40 = 15, Int :$growth-rate where $_ < 5 = 3 ) { for 1..$months -> $month { say "** month {$month} **\ntotal: @pairs.elems()"; # Adults have babies. Place the newborns in incubation. my RabbitPair @newborns; for @pairs -> $pair { if $pair > 0 { @newborns.push(0) for ^$growth-rate; } } # Age the rabbits @pairs.=map: { $_ + 1 }; # Add the newborns to the rest @pairs.append: @newborns; } }
Editor Settings
Theme
Key bindings
Full width
Lines