Please Write C Program Check Tic Tac Toe Game Show Winning Result Detail Application Progr Q43788902
Please write a C++ program to check atic-tac-toe game and show its winning result in detail. This is anapplication program of a 3-dimensional list or array.
Your complete test run output must look as follows. This testreally checks to make sure your program is performing perfectly tocheck every possible winning situation for X and O.
Welcome to the TicTacToeprogram by “you”!
GAME 0 is asfollows:
OOO
OOO
OOO
O won by row 1
O won by row 2
O won by row 3
O won by column 1
O won by column 2
O won by column 3
O won by diagonal1
O won by diagonal2
GAME 1 is asfollows:
XXX
XXX
XXX
X won by row 1
X won by row 2
X won by row 3
X won by column 1
X won by column 2
X won by column 3
X won by diagonal1
X won by diagonal2
GAME 2 is asfollows:
XOX
XXO
XOO
X won by column 1
X won by diagonal2
GAME 3 is asfollows:
XOO
OXO
XXO
O won by column 3
GAME 4 is asfollows:
XOX
OXO
XOO
X won by diagonal2
GAME 5 is asfollows:
OXO
XOX
XOX
It is a tie.
Please enter your game board(* to exit)>OOOXOXOXO
Your game board is asfollows:
OOO
XOX
OXO
O won by row 1
O won by diagonal1
O won by diagonal2
Please enter your game board(* to exit)>OXOOXOOXO
Your game board is asfollows:
OXO
OXO
OXO
O won by column 1
X won by column 2
O won by column 3
Please enter your game board(* to exit)>XOXXXXOXO
Your game board is asfollows:
XOX
XXX
OXO
X won by row 2
Please enter your game board(* to exit)>*
Thank you for playing thisgame designed by “you”
Your main program must have the following code to set up thepreset 6 games.
# MAIN PROGRAM:================================================.
print (“Welcome to theTicTacToe program designed by “you”)
O = ‘O’ #player O
X = ‘X’ #player X
tlist = [ [[O,O,O], # Game 0 # tlist is like a3-dimensional array.
[O,O,O],
[O,O,O]] ,
[[X,X,X], # Game 1
[X,X,X],
[X,X,X]] ,
[ [X,O,X], # Game 2
[X,X,O],
[X,O,O] ],
[[X,O,O], # Game 3
[O,X,O],
[X,X,O] ] ,
[[X,O,X], # Game 4
[O,X,O],
[X,O,O] ],
[[O,X,O], # Game 5 # It is atie.
[X,O,X],
[X,O,X] ] ]
for i in range(6): # 6 gamesto check one by one
print(“GAME”, i ,” is as follows:”)
show(tlist[i] )
checkwin(tlist[i] )
# More code to keep getting input from the user for the nextgame
# Stop this program if user’s input is ‘*’
# Thank the user before exit
# End of Program########################################
You must define show( ) function to show the3X3 game board.
You must define checkwin( ) function to checkall the winning situations for X and O.
You must define 8 functions to check 8 possibilities to win:
Expert Answer
Answer to Please write a C++ program to check a tic-tac-toe game and show its winning result in detail. This is an application pro…
OR