Penney's game: Difference between revisions

m
→‎{{header|Perl 6}}: flatten coin flip lists
(Added Kotlin)
m (→‎{{header|Perl 6}}: flatten coin flip lists)
Line 1,595:
 
=={{header|Perl 6}}==
{{works with|Rakudo|2018.02}}
 
<lang perl6>enum Coin <Heads Tails>;
enum Yay <Yay Good Super Hah Ooh Yipee Sweet Cool Yes Haha>;
Line 1,629 ⟶ 1,631:
 
if $flip == $mefirst {
print "{Yay.pick}! I get to choose first, and I choose: "; sleep 2; say @mine = |Coin.roll(3);
@yours = your-choice("Now you gotta choose: ");
while @yours eqv @mine {
Line 1,640 ⟶ 1,642:
@yours = your-choice("{Boo.pick}! First you choose: ");
say "OK, you'll win if we see: ", @yours;
print "In that case, I'll just randomly choose: "; sleep 2; say @mine = Coin(+!@yours[1]), |@yours[0,1];
}
Line 1,662 ⟶ 1,664:
sleep 1;
print "Here we go!\n\t";
for |Coin.roll(3), &check ...^ :!defined {
flipping;
print "$_ ";
2,392

edits