using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace xox.
{
internal class Program.
{
static string[,] board = { { "1", "2", "3" }, { "4", "5", "6" }, { "7", "8", "9" } };
const string userCharacter = "X";
const string computerCharacter = "O";
private static void Board()
{
Console.WriteLine(" | | ");
Console.WriteLine(" {0} | {1} | {2}", board[0,0], board[0, 1], board[0,2]);
Console.WriteLine("_____|_____|_____ ");
Console.WriteLine(" | | ");
Console.WriteLine(" {0} | {1} | {2}", board[1,0], board[1, 1], board[1, 2]);
Console.WriteLine("_____|_____|_____ ");
Console.WriteLine(" | | ");
Console.WriteLine(" {0} | {1} | {2}", board[2, 0], board[2, 1], board[2, 2]);
Console.WriteLine(" | | ");
}
static void Topbar()
{
Console.WriteLine("Welcome to XOX");
Console.WriteLine();
Console.Write("Player X: ");
Console.WriteLine("Player O: ");
}
static void GamePlay()
{
List<int> choices = new List<int>();
Console.WriteLine("Enter a number: ");
int userchoice = Convert.ToInt32(Console.ReadLine());
choices.Add(userchoice);
int index = userchoice - 1;
int row = 0;
if (index > 0)
{
row = index / 3;
}
int column = userchoice % 3;
if (column == 0)
{
column = 2;
}
else if (column == 2)
{
column = 1;
}
else.
{
column = 0;
}
board[row, column] = userCharacter;
Console.Clear();
Board();
/*
Minimax algorithm will be added.
*/
}
static void Main(string[] args)
{
Topbar();
Board();
GamePlay();
Console.ReadLine();
}
}
}