Answered step by step
Verified Expert Solution
Question
1 Approved Answer
in C++ please 3.1 String-representation tttresult Write a function with the following signature char tttresult (string tttboard); The string tttboard has nine characters representing the
in C++ please
3.1 String-representation tttresult Write a function with the following signature char tttresult (string tttboard); The string tttboard has nine characters representing the current situation in a game of tic tac toe x represents x o represents o # represents an unplayed space The first three characters are the top row, the next three the middle row, and the last three are the bottom row So the line: represents the board The program should classify the board as one of the following . t: tie game and no spaces left . x: valid, x has won . o: valid, o has won * c: valid, game continues i invalid . e: error condition (bad shape of board, bad chars) An invalid game board is one in which there was a rule violation. A game can be invalid for many reasons, such as too many winners, unbalanced number of x's and o's, etc Do not "anticipate" tie games: a game is considered a tie only if all the spaces are filled 3.1.1 Examples tttresult("xox#x#xox" ) returns i It is invalid because x played 5 times and o only played 2 times tttresult( "xoxoxoxox") returns x
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started