19
You are given a partially filled Connect 4 grid (7x6).
O X
O X
X O X O O
X O X O X X
O X X X O O X
O O O X X O X
(Input can be given as a 1D or 2D array and as letters or numbers, etc.)
Assume that
- X started the game.
- Nobody has won yet.
- Players may not have played well until now, but now onwards they will both employ optimal strategies.
- Input grid is not faulty.
You must output a single value that indicates which player wins (or a draw)
Code golf challenge; so shortest code wins. Your program does not have to actual compute the output in reasonable amount of time, but you should be able to prove that the output will be obtained correctly in a finite amount of time.
Related. – Martin Ender – 2015-11-11T14:13:51.967
@MartinBüttner Does that mean I will get downvoted, or is it okay to leave my question here? – ghosts_in_the_code – 2015-11-11T14:25:42.610
4It just means the questions are related, nothing more, nothing less. The purpose of posting the link is for the challenges to appear in each other's "Linked" sidebar, so people can find related challenges more easily. If I considered your question a duplicate, I would have said so (or just closed it), so don't worry. :) – Martin Ender – 2015-11-11T14:27:12.757
2Is "optimal play" well defined? If so, can you provide a link describing the algorithm for optimal play? – Rainbolt – 2015-11-11T14:28:16.993
2
@Rainbolt It has been solved and there exist perfect algorithms also. Read Wikipedia for more.
– ghosts_in_the_code – 2015-11-11T14:34:46.323