Question
I need help in C# and it needs to be done in Visual studio please. I also attach the given code for this. Here is
I need help in C# and it needs to be done in Visual studio please.
I also attach the given code for this.
Here is the given code.
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;
namespace playingAround { class Program { static void Main(string[] args) {
//Use this help code to set up a game of tic-tac-to.
//show the user a numbered board so they know what square to pick // 1 2 3 // 4 5 6 // 7 8 9
//Randomly decide who goes first
//computer or user picks an empty square to put their mark. User is always X, computer always O //make sure no comoputer or user choice is overwritten //if any row, column or diagonal has every place filled, check for a win //computer turn is a random place into any square. //Choices cannot be overwritten so you might want to declare a variable for each row, column and diagonal to keep track of things. Or not. //Declare a win when it occurs for either side, or declare a tie if there way no winner //As usual, intro the game, let the user play again if they want. //Clear the screen intelligently so that it looks like we are playing on a single game board //user wins if they get three X in any one row, column or diagonal, computer wins if the same conditions exist for Os.
string[,] theBoard = new string[3, 3] { { " ", " ", " "}, { " ", " ", " "}, { " ", " ", " "} };
Console.WriteLine($" {theBoard[0, 0]} | {theBoard[0, 1]} | {theBoard[0, 2]}"); Console.WriteLine("---|---|---"); Console.WriteLine($" {theBoard[1, 0]} | {theBoard[1, 1]} | {theBoard[1, 2]}"); Console.WriteLine("---|---|---"); Console.WriteLine($" {theBoard[2, 0]} | {theBoard[2, 1]} | {theBoard[2, 2]}");
Console.ReadKey();
} } }
Arrays: Make a magic crystal ba Hee are the possible outcomes: It is certain' o 'It is decidedly so 'Yes' 'Reply hazy try again 'Ask again later Concentrate and ask again' 'My reply is no "Outlook not so good 'Very doubtful" Make each outcome an element of an array. Randomly generate a number from 0 to the length of the array to display a random "magic ball answer". Set this up in a modest loop welcoming the user and prompting them to press enter fora response from the magic crystal ball. Clear the screen and reveal the response. Prompt for another response or end the program
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