Question: IN C# CODE PLEASE Complete the Programming Challenge #8 Tic-Tac-Toe Simulator on Page 470. Make sure to use proper naming conventions, include the header comments

IN C# CODE PLEASE

Complete the Programming Challenge #8 Tic-Tac-Toe Simulator on Page 470. Make sure to use proper naming conventions, include the header comments and comments for each click event outlining what the code is doing.

Homework Help: It is OK for the tic-tac-toe board to have a row of X's and O's (or columns). This would result in a tie. Similarly, if there were no consecutive X's and O's at all, this could either be a tie - or no one wins. My suggestion would be to code the if's to check all of the rows, columns and diagonals but keep a counter which is incremented any time a successful match is found. Example.... if the board looks like this:

X X X --> When you fall in this if check, have xWinningCount++

O O O --> When you fall in this if check, have oWinningCount++

X O X

Then after all of the if checks you can have: if((xWinningCount > 0 && oWinningCount > 0) || (xWinningCount == 0 && oWinningCount == 0) ) outputLabel.Text = "Tie Game!";

Another example of a randomized board:

X X X --> xWinningCount++

X X X --> xWinningCount++

O X O

There is also no need to simulate a player 1 takes a turn and then a player 2 has a turn, the entire board is filled off of a 2-d array at one time.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!