Re: A new golf "Reversi" has started
[email protected] (Juho Snellman) Sat, 22 Nov 2003 17:04:56 +0200
| Newsgroups | perl.golf |
|---|---|
| Message-ID | <[email protected]> |
On Fri, Nov 21, 2003 at 03:43:39PM -0600, Riley wrote:
> -p0 $_=reverse,s/\.(?=(.{$&}x)+.{$&}o)/*/swhile$^C+=9870=~/./g
>
> I looked up the $^C predefined variable and found:
> The current value of the flag associated with the -c
> switch.
$^C has the nice property that it only stores 8 bit integers (i.e. it
only stores the values -128..127). If a value that's too large is
assigned to the variable it (like all variables) wraps around back to
the minimum. Since the value of an assignment expression (like +=) is
the value of the assigned thing, the loop ends whenever the value of
$^C becomes 0, i.e. after $^C has been incremented 255 times[*].
Does that answer your question?
[*] Actually, it's been incremented a bit more often than that, but
some of the incrementations have been by 0, not 1.
--
Juho Snellman