Tic-Tac-Latin!
This is a true story, so names have been altered.
My latin teacher, Mr. Latin, created his own proprietary (no joke) tic tac toe variant. Let's call it tic-tac-latin. The game is simple, it is essentially tic tac toe played on a four by four grid.
Formal rule declaration
A line is either a row, column or a diagonal. There are two symbols, 'X' and 'O', but one or both may be substituted for a different symbol.You score one point when you have three of your symbol and one of the other character.
These arrangements score:
X--O OO-- XXXO XOOXThese do not score:O-XX -O-- --X- ---O
---- XXXX ---- OOOO ---- XXX- ---- OOO-
The game is won whenever one player has more points then another. The game is a draw only if the board gets filled up.
Challenge
Solve this game. Your job is to provide a way to guarantee a win or tie, whichever is the optimal result.
Your solution may choose to either start first or second (and may therefore choose it's symbol). It is not mandatory to implement an interactive game where the user inputs moves and the corresponding display changes. It may also be a function or program which takes input as a game state, and outputs a new board or a description of their move. Either option must run within approximately ten seconds per move made.
Playing your player against any sequence of moves must give the optimal result. This means that you may assume the input position is one that it reachable from play with your player. Submissions must be deterministic, and do not necessarily need to supply a proof of optimality, but if they get cracked (by being beaten) your submissions will be considered invalid (you may leave it up, but add (cracked) in the headline).
This is a non-trivial task, so any valid submission is impressive and is worthy of an accepted tick, but I will make code golf the primary winning criterion.
The winner is chosen by going down this list till one winner is chosen.
- Shortest solved implemenation which always wins
- Shortest implementation