Hi,
This is more of a feature request, although it might actually require a totally different algorithm.
In the Xbox One version of the game there are three achievements that relate to getting the board into a special position, which is a "lock" position. For example, "Threelock" requires the board to be entirely locked (no moves available) with a 3 tile in every alternating square. "Sixlock" and "Twelvelock" are the same except with the 6 and 12 tiles respectively.
Example of a Sixlock: http://i.imgur.com/ka0OQWk.png
I was wondering if you might have some ideas on how to code the AI to do this?
Thanks for reading,
Tarragon
Interesting. I think the most challenging part will be to develop a good evaluation algorithm for these various locks. The AI needs a way to determine if it is getting closer to the goal. The search functionality will work as-is with a good search heuristic.
One way to reach the threelock/sixlock/twelvelock condition is to introduce a heuristic that counts the number of locked rows in a configuration:
```
def row_locked(row: ThreesRow, lock_tile: ThreesTile, parity: Bool):
... # detect where locktile appears in alternating positions
def board_locked_level(board: ThreesBoard, lock_tile: ThreesTile):
# Detect lock status and parity of first row
# Count number of consecutive locked rows of alternating parity
...
```
Now we can score a position in terms of its locked rows number.
This heuristic bakes in the assumption that any threeslock attempt must lock the first row, the second row, and so on.
This might be bad if winning threeslock strategies need to be able to break the tiered threeslock heuristic. Also, the row-wise heuristic might not give us enough information to inform row formation strategy.
I am not sure whether the existing implementation would allow us to vary the heuristic like this, but I will investigate!