Declare and implement a function called gameOver
.
gameOver
receives a single 3x3 Array<CharArray>
as a parameter, representing a tic-tac-toe board,
with each cell containing either a X
, a O
, or a (blank space).
gameOver
should return X
if X
has won the game, O
if O
has won the game, and a blank space (' ') otherwise,
including in the case of ties.
(Ties should probably be handled differently, but you can use a ' ' for now.)
Do not check the diagonals!
For those unfamiliar with Tic-Tac-Toe, here is link to the rules: https://en.wikipedia.org/wiki/Tic-tac-toe.
Stuck? You may find these lessons helpful: