Flipping bits game: Difference between revisions
m
→{{header|Perl}}: future-proof for 5.36, use new bitwise string operators
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
SqrtNegInf (talk | contribs) m (→{{header|Perl}}: future-proof for 5.36, use new bitwise string operators) |
||
Line 4,367:
valid rows or columns, and disregards any irrelevant text in between.
<syntaxhighlight lang="perl">
use warnings qw(FATAL all);
use feature 'bitwise';
my $n = shift(@ARGV) || 4;
Line 4,392:
{
for(@rows, @cols) {
$start ^.= $_ if int rand 2;
}
redo if $start eq $goal;
Line 4,432:
$did_one = 1;
if( /\d/ ) {
$start ^.= $rows[$_-1];
} else {
$_ = ord(lc) - ord('a');
$start ^.= $cols[$_];
}
++$moves_so_far;
|