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'.You score 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-
You win the game if you score and in the process do not score for your opponent.
Challenge
Solve this game. Your job is to provide a way to guarantee a win (or tie).
Your solution may choose to either start first or second. 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.
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.
- Only solved implementation which always wins
- Shortest solved implemenation which always wins
- Only implementation
- Shortest implementation