Brain Phrye

code cooking diy fiction personal photos politics reviews tools 


Reframing tic-tac-toe

[ Listen to article ]

A while back I recorded my high school tic tac toe program. I notice I failed to paste up the code, but I’ll do that in a later part of this.

For now I got distracted by this video which reframed tic tac toe as a magic square problem. Which means I could just use math to see if a winning move had been made.

So now I rewrote it in javascript here. This is just a simple version. I’ll add the ability for the computer to play - and possibly have a few strategies to try.