Flipping bits game: Difference between revisions
Content added Content deleted
(Added a link to MapleCloud) |
SqrtNegInf (talk | contribs) m (→{{header|Perl 6}}: fixed scramble routine) |
||
Line 2,211: | Line 2,211: | ||
=={{header|Perl 6}}== |
=={{header|Perl 6}}== |
||
{{Works with|rakudo|2016.11}} |
|||
Pass in a parameter to set the square size for the puzzle. (Defaults to 4.) Arbitrarily limited to between 1 and 26. Yes, you can choose to solve a 1 element square puzzle, but it won't be very challenging. Accepts upper or lower case letters for columns. Disregards any out-of-range indices. Enter a blank or 0 (zero) to exit. |
Pass in a parameter to set the square size for the puzzle. (Defaults to 4.) Arbitrarily limited to between 1 and 26. Yes, you can choose to solve a 1 element square puzzle, but it won't be very challenging. Accepts upper or lower case letters for columns. Disregards any out-of-range indices. Enter a blank or 0 (zero) to exit. |
||
Line 2,264: | Line 2,265: | ||
sub scramble(%hash) { |
sub scramble(%hash) { |
||
my @keys = keys %hash; |
my @keys = keys %hash; |
||
@keys |
@keys.push: | keys %hash{'1'}; |
||
flip $_, %hash for @keys.pick( @keys/2 ); |
flip $_, %hash for @keys.pick( @keys/2 ); |
||
}</lang> |
}</lang> |