Computer Science Homework Help

Computer Science Homework Help. modify my code….

I want To modify my code to give one player 4 places and the other one is 5. What I want is each player has 3 places and if he fill it and did not win it will move the place to another place and the place he was in it will return to number

————————————

————————————–

using System;

public class Program
{
static int flag = 0;
static int player = 1;
static char[] arr = { ‘0’, ‘1’, ‘2’, ‘3’, ‘4’, ‘5’, ‘6’, ‘7’, ‘8’, ‘9’};
public static void Main(){
int choiceMode;
Console.WriteLine(“Welcome to X O Game. Please select one of the mode to start the game:n 1.Player to Player n 2. Player to computern 3. Computer to comuter”);
choiceMode=int.Parse(Console.ReadLine());
if (choiceMode==1){
playersMode();

}

}

static void Board(){
int x = 1;
Console.WriteLine();
for (int row = 0; row < 3; row++)
{
for (int col = 0; col < 3; col++)
{
Console.Write(arr[x]);
Console.Write(” | “);
x++;
}

Console.WriteLine(“n___|_____|_____”);

}
}

static void playersMode(){
string player1, player2=” “;
Console.WriteLine(“What is the name of player 1?”);
player1 = Console.ReadLine();
Console.WriteLine(” What is the name of player 2?”);
player2 = Console.ReadLine();
Console.WriteLine(“{0} is O and {1} is X.” , player1, player2);
Board();

do{
if (player % 2 == 0)//checking the chance of the player
{
Console.WriteLine(“{0} turns now.” , player1);

}
else{
Console.WriteLine(“{0} turns now.” , player2);
}

int choice = int.Parse(Console.ReadLine());
if (arr[choice] != ‘X’ && arr[choice] != ‘O’){
if (player % 2 == 0) //if chance is of player 2 then mark O else mark X
{
arr[choice] = ‘O’;
player++;

}
else {
arr[choice] = ‘X’;
player++;
}

Board();

}else //If there is any possition where user want to run and that is already marked then show message and load board again
{
Console.WriteLine(“Sorry the row {0} is already marked with {1}”, choice, arr[choice]);
}

}while(flag != 1 && flag != -1);
}}

Computer Science Homework Help

 
"Our Prices Start at $11.99. As Our First Client, Use Coupon Code GET15 to claim 15% Discount This Month!!"