using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Threading;
namespace tictoegame
{
public class gamestart
{
int functionalcount, computernumber,usernumber;
char\[\] box = new char\[9\];
static int j=6;
public gamestart()
{
for(int k=0;k<9;k++)
{
box\[k\] = ' ';
}
functionalcount = 0;
Random rd = new Random();
while(true)
{
computernumber = rd.Next(0, 8);
if (box\[computernumber\]!='x'&& box\[computernumber\]!='X'&&box\[computernumber\]!='o'&& box\[computernumber\]!='O')
{
insertvalue(computernumber,Program.computersymbol);
break;
}
}
functionalcount++;
userturn();
}
public void position()
{
int i=1;
Console.CursorLeft=i;
Console.CursorTop=j;
j++;
}
public void userturn()
{
if (functionalcount != 9)
{
bool flag1 = checkwin(Program.usersymbol);
if (flag1)
{
position();
Console.WriteLine("you won");
Thread.Sleep(3000);
Environment.Exit(0);
}
else
{
while (true)
{
position();
Console.WriteLine("enter the number for symbol");
usernumber = Convert.ToInt32(Console.ReadLine());
if (box\[usernumber\] != 'x' || box\[usernumber\] != 'X' && box\[usernumber\] != 'o' || box\[usernumber\] != 'O')
{
insertvalue(usernumber, Program.usersymbol);
functionalcount++;
break;
}
}
computerturn();
}
}
}
public void computerturn()
{
int count=0,i;
if (functionalcount == 2)
{
Random rd = new Random();
while (true)
{
com