Non-transitive dice: Difference between revisions

m
→‎{{header|Raku}}: update timing and make insignificant changes
(→‎{{header|Raku}}: minor efficiency tweaks)
m (→‎{{header|Raku}}: update timing and make insignificant changes)
Line 1,235:
 
=={{header|Raku}}==
TheThanks to Thundergnat for the nice "less-is-more" tweaks now the 4 dice portion tooktakes around 1710 (down from 2817 ) minutes to run .. so it is not done yet.
{{trans|Go}}
<lang perl6># 20201225 Raku programming solution
Line 1,252:
}
 
sub infix:<⚖️>(@x, @y) { +($_{Less} <=> $_{More}) given (@x X<=> @y).Bag }
my \b = (@x X<=> @y).Bag;
+(b{Less} <=> b{More})
}
 
sub findIntransitive(\N, \cs) {
my @res = [];
race for [X] ^+cs xx N -> @dielot {
my $skip = False;
for @die[0..*]lot.rotor(2 => -1) -> @p {
{ $skip = True and last } unless cs[ @p_[0] ] ⚖️ cs[ @p_[1] ] == -1
}
next if $skip;
if cs[ @dielot[0] ] ⚖️ cs[ @dielot[*-1] ] == 1 { @res.push: [ cs[ @die[0..*]lot ] ] }
}
@res
351

edits