in reply to (Golf) Tic Tac Toe
The relaxation's are you automatically lose if you try to cheat :-P i.e; given invalid input UPDATE: this can be remdedied with a goto but that brings it up to 153. The output is a little jury-rigged. I use 0 instead of O to allow for some shaving. Also, instead of where you die $p, the loser dies in this game.$_="123 456 789 147,258,369,159,357"; sub d{/.{12}/s;print$&.($p= $p?0:X);die$_ for@_}d; while(<>=~/\d/&&s/$&/$p/g){ /$p{3}/?d$p:!/\d/ ?d"Tie":d }
UPDATE 2: 144
$_="123 456 789 147,258,369,159,357"; sub d{/.{12}/s;print$&.( $p=$p?0:X);@_&&die@_}d; while(<>=~/\d/&&s/$&/$p/g){ /$p{3}/?d$p:!/\d/?d"Tie":d }
I should mention, I really like the way you use $_. It takes a double-take or two to figure out what's going on but it's rather elegant.
--
I'm not belgian but I play one on TV.
|
|---|