Question: Write a function that determines who has won a game of tic-tac-toe. The function should receive a character array containing the moves of tic-tac-toe game
Write a function that determines who has won a game of tic-tac-toe. The function should receive a character array containing the moves of tic-tac-toe game as given below. first check all rows to see whether one player occupies all the cells in one row, next check all columns, and then check the two diagonals. The function should return a value of 1, 0, -1 in case player 1 wins, draw and player 2 wins, respectively. Assume player 1 marks ‘o’ and player 2 marks ‘x’. Assume, the position for no-move contains ‘ ’ (space character)
Step by Step Solution
3.56 Rating (167 Votes )
There are 3 Steps involved in it
include int checkWinnerchar arr33 int ij... View full answer
Get step-by-step solutions from verified subject matter experts
