2048: Difference between revisions
m
→{{header|Perl 6}}: Update for recent proto requirement for overridden core subs
m (→{{header|REXX}}: added notations to better show the user's inputs.) |
Thundergnat (talk | contribs) m (→{{header|Perl 6}}: Update for recent proto requirement for overridden core subs) |
||
Line 4,109:
=={{header|Perl 6}}==
Uses termios to set the terminal options, so only compatible with POSIX terminals. This version does not include a specific "win" or "lose" condition. (though it would be trivial to add them.) You can continue to play this even after getting a 2048 tile; and if there is no valid move you can make, you can't do anything but quit.
{{works with|Rakudo|
<lang perl6>use Term::termios;
Line 4,183:
sub combine ($v is rw, $w is rw) { $v += $w; $w = ''; $score += $v; }
multi move('up') {
map { @board[*;$_] = squash @board[*;$_] }, ^n;
}
multi
map { @board[*;$_] = reverse squash reverse @board[*;$_] }, ^n;
}
multi
map { @board[$_] = squash @board[$_] }, ^n;
}
multi
map { @board[$_;*] = reverse squash reverse @board[$_
}
|