Skip to content

Instantly share code, notes, and snippets.

@cwake
Last active February 4, 2017 01:35
Show Gist options
  • Save cwake/ef346197505d925695584bb128665306 to your computer and use it in GitHub Desktop.
Save cwake/ef346197505d925695584bb128665306 to your computer and use it in GitHub Desktop.
using System;
namespace _10_10_Test
{
class Test {
static void Main (string[] args) {
string playerName = "";//set empty string for the players namespace
bool endGame= false;
Console.WriteLine("Please enter the name for Player 1:");
playerName = Console.ReadLine();
TicTacToe player1 = new TicTacToe(1, playerName); // pass information to the TicTacToe class
Console.WriteLine("Please enter the name for Player 2:"); //get informationfor player 2
TicTacToe player2 = new TicTacToe(2, playerName);
while(!endGame)//while the game is not over
{
TicTacToe.makeBoard();//display board with 0'string
while(!player1.Game() && !player2.Game())//play game until the game ends, aka one statement is true
endGame =true;
if(endGame)
{
Console.WriteLine("Would you like to play again? Y/N");
if(Console.ReadLine("Y"))
endGame = false;
if(Console.ReadLine("N"))
endGame= true;
else
Console.WriteLine("Invalid Input! Please try again!");
Console.ReadLine();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment