Current thoughts on strategy:<p>You shouldn't care how you are affecting your opponent's board (you are affecting it randomly).
So just play for your own board.<p>On an empty board:<p><pre><code> The centre square is the most valuable, crossing 4 lines
The diagonals are also valuable, crossing 3 lines
All the other squares are equally not-valuable, crossing 2 lines.
However - the squares change their value (a lot) depending on what your opponent plays.
</code></pre>
A good strategy is therefore to wait and see what your opponent plays, then greedily collect the lines that they nearly fill in by random chance.<p>To acheive this... fill the valuable squares: centre and diagonals, while your opponent fills other places randomly. I guess they are doing the same.<p>Once you're done with the diagonals: fill the line which is most close to completed. This does not require too much thought - once you start filling a line, it's nearly always right to keep filling it.<p>You can break ties between lines, where necessary, by looking at which crossing lines are nearly filled.<p>Although the robot has the advantage of seeing what the player plays, I believe the first move outweighs this advantage (especially on the larger boards?)
This was quite interesting, but it's so annoying to see multiple 1 line comments from new accounts, and accounts that have very little history. Even more annoying, the older "spammy" accounts all seem to be linked to accredible, the site hosting the game. Over half the contributions on this page are from those accounts; <i>niveshi</i>, <i>lateguy</i>, <i>aheppenstall</i>, <i>ambitionvc</i>, <i>amarsaurabh</i>, <i>rachana318</i>.<p>Apart from all that, this looks like it would be fun to turn into a pure javascript clone. The network connection seems completely unnecessary, and it would be fun to create competing AIs.
Neat! This was fun to think about.<p>Given the complete lack of relationship between the two matrices, the fact that you're playing against a computer seems immaterial. You make a move, and then a random square is filled in. You lose if you don't achieve the win condition in some number of turns (I wanna say around n^2/2).<p>That said, here's a greedy algorithm I've arrived at, similar (but not identical to) ronaldx's:<p>For an unfilled point p on an unfinished line, define its value, v(p). There are a bunch of ways to do this, but one that I've thought of is: the number of x's on all unfinished lines through that point.<p>1. Fill in the center square<p>2. Choose an unfinished line with a maximal number of x's such that the sum of the values of all its unfilled points is /maximal/<p>3. Fill in a point p on that line with v(p) /minimal/<p>4. Goto: step 2<p>Reasoning for step 1: The center space opens up the most options, lying on more lines than any other point.<p>Reasoning for step 2: You want to pick a line to fill in. Moreover, you want the filling in of its points to benefit your efforts elsewhere as much as possible.<p>Reasoning for step 3: Now that you've picked a line, you're going to fill in all its points. You pick the points in ascending order of value to give the robot as much time as possible to fill in the best points for you.