Hacker News new | ask | show | jobs
by ronaldx 4405 days ago
Current thoughts on strategy:

You shouldn't care how you are affecting your opponent's board (you are affecting it randomly). So just play for your own board.

On an empty board:

  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.
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.

To acheive this... fill the valuable squares: centre and diagonals, while your opponent fills other places randomly. I guess they are doing the same.

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.

You can break ties between lines, where necessary, by looking at which crossing lines are nearly filled.

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?)

1 comments

This works well for the lower levels but as the grid gets bigger, a refinement stage needs adding to the tiebreak. I suggest switching view from per-square to per-line for tiebreaks. How about this:

Larger grid: 1. take centre and fill diagonals

2. for the first few lines a big grid (say level 5) is big enough that the differences between optimal and not are small, so use "most close to completed" for a few lines

3. After a few lines (I want to say 30% of target?), the "most close to completed" ties will become more relevant. Breaking ties from the focus of one square doesn't work, because the computer's completion could change things.

4. Instead, to break a tie look at the lines that cross the candidate lines. For each number in the candidate, count the Xs that cross it. Sum the Xs for a line to find a value. Do this for each candidate and the most valuable is the candidate to pick.

This works well because even a small difference in value becomes very important towards the end.