| Welcome from United States. |
|---|
| c h r i s c o d e s i t e |
use v6; # Auteur : Christian Aperghis-Tramoni. # Langage : Perl 6. my @obj =< Ciseaux Papier Rocher >; my @res = <Perd Nul Gagne>; my %scores = ( @obj[1] => [ @obj ], @obj[0] => [ @obj[2,0,1] ], @obj[2] => [ @obj[1,2,0] ] ); sub($a, $b) { return [~] (@res >>xx<< (%scores{$a} >>eq>> $b)); } my $rep; for @obj X @obj -> $i, $j { $rep = pcr($i,$j); say ("$i contre $j, resultat : ", $rep eq "Nul" ?? "" !! $i, " $rep."); } |