Answer the question
In order to leave comments, you need to log in
How to find the number of elements in an array?
Can you please tell me how to count the number of steps/elements in an array for a certain figure and output it to the console?
void Start()
{
int count = Enum.GetNames(typeof(Figure)).Length; //запрос из списка Enum
moves = new List<Coords>[count][,]; //фигуры с массивом списков координат для фигур
moves[(int)Figure.Rook] = new List<Coords>[8, 8]; //список координат для Ладьи
for (int x = 0; x <= 7; x++)
for (int y = 0; y <= 7; y++)
moves[(int)Figure.Rook][x, y] = RookMoves(x, y);
moves[(int)Figure.King] = new List<Coords>[8, 8]; //список координат для Короля
for (int x = 0; x <= 7; x++)
for (int y = 0; y <= 7; y++)
moves[(int)Figure.King][x, y] = KingMoves(x, y);
moves[(int)Figure.Queen] = new List<Coords>[8, 8]; //список координат для Ферзя
for (int x = 0; x <= 7; x++)
for (int y = 0; y <= 7; y++)
moves[(int)Figure.Queen][x, y] = QueenMoves(x, y);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question