Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

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

Students also viewed these Databases questions

Question

4. What advice would you give to Carol Sullivan-Diaz?

Answered: 1 week ago