O's and X's

Published by poinsettiarain in

Given a list containing three strings, representing the rows of an O's and X's board from top to bottom, return the row and column position of the winning move for X's. Return False if the game cannot be won.

Examples

x_and_o(board = [" | | ", " |X| ", "X| | "]) ➞  [1, 3]

# Board becomes:
#    |   |
#    |X |
# X |   |

x_and_o(board = ["X|X|O", "O|X| ", "X|O| "]) ➞ [3, 3]

# Board becomes:
# X|X|O
# O|X|
# X|O|

Notes

There is no 0 index for the row or column.

Watch a quick demo on how Edabit works.