Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

include int checkWinnerchar arr33 int ij... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mobile Communications

Authors: Jochen Schiller

2nd edition

978-0321123817, 321123816, 978-8131724262

More Books

Students also viewed these Programming questions

Question

Differentiate the function. r(z) = 2-8 - 21/2 r'(z) =

Answered: 1 week ago

Question

How do inclination and elevation determine the use of a satellite?

Answered: 1 week ago