I am a begginer. I am stuck upon a problem about namimng the colums and the lines, differently than 0 to 10. something like this picture, the lines starting from the bottom 1 to 10 and colums from A to J.
I've created a program that tells me if the ship is destroyed or not, after using some moves( in this image using move 5 c, in my program 5 2, counts as a hit, if all the blue squares are hit the program returns destroyed).
char[,] board = new char[10, 10];
for (int i = 0; i < 10; i++)
{
string line = Console.ReadLine();
string[] boardCharacters = line.Split(' ');
for (int j = 0 ; j < 10; j++)
board[i, j] = Convert.ToChar(boardCharacters[j]);
}
int countHits = 0;
for (int z = 0; z < 14; z++)
{
var attackCoordinates = Console.ReadLine().Split(' ');
int[] attack = new int[2];
for (int i = 0; i < 2; i++)
{
attack[i] = int.Parse(attackCoordinates[i]);
}
if (board[attack[0], attack[1]] == 'x')
{
countHits++;
}
}
if (countHits == 8)
{
Console.WriteLine("destroyed");
}
else
{
Console.WriteLine("not destroyed");
}
What should I change and how should I change it?
