in reply to (Golf) Tic Tac Toe
Just an idea. This may or may not help in the golf, but is good to know anyway.
If you take this magic square:
and play tic-tac-toe on it, you have three in a row iff you have three different cells so that the sum of their three numbers is 15.2 9 4 7 5 3 6 1 8
Source of the idea:
Csákány Béla, Diszkrét matematikai játékok.
1998, Polygon, Szeged
pp. 100-101
Update: changed 1 in 1st row to 2. Thanks to jdhawke and also QM for noticing the typo.
Update: this one does not check for valid moves so it's easy to cheat. Also, it does not detect ties yet.
s;;294 753 618 ;;$f=(OX)x9;{print$_,$u=chop$f;$n=<>-Q;s;$n;$u;e;$$u&1<<15-$n&&die$u.$ +/;$$u|=$$u[0]<<$n;$$u[0]|=1<<$n;redo}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: (Golf) Tic Tac Toe
by jdhawke (Acolyte) on Jun 06, 2004 at 23:55 UTC | |
|
Re^2: (Golf) Tic Tac Toe
by QM (Parson) on Jun 06, 2004 at 23:56 UTC | |
by thospel (Hermit) on Jun 07, 2004 at 18:14 UTC |