Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Re: RE: Tic Tac Chop

by 2501 (Pilgrim)
on Dec 12, 2000 at 07:16 UTC ( [id://46204]=note: print w/replies, xml ) Need Help??


in reply to Re: RE: Tic Tac Chop
in thread Tic Tac Chop

you can trim a couple more off the $m assignment to:
$_="1 2 3\n4 5 6\n7 8 9\n";$m="XO"x5; {print;<>=~/^\d$/until$&&&s/$&/$p=chop$m/e; /^($p.){3}|($p.{5}){2}$p|^.(...$p){3}|($p{7}){2}$p/ms||$m&&redo} y/0-9/-/,print
I am still trying to grok a way to trim that regex down. a definite ++

Replies are listed 'Best First'.
Re: Re: Re: RE: Tic Tac Chop
by japhy (Canon) on Dec 12, 2000 at 19:31 UTC
    No, you can't, since $m's length is used to stop the looping of the program. It has to have length of 9.
    chop($m="XO"x5); # 16 $m="XOXOXOXOX"; # 15 $x="X"."OX"x4; # 14
    There's a one character optimization. Oh, and I left out a . from my code (and thus, it shows above in yours) at the $p{7}. It should be $p.{7}.

    japhy -- Perl and Regex Hacker

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://46204]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (8)
As of 2024-04-19 15:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found