Esempio n. 1
0
        private static void Strike(ref List <List <long> > matrix, ref TargetDetails target)
        {
            for (var row = target.Row - target.Radius; row <= target.Row + target.Radius; row++)
            {
                if (row < 0 || row >= matrix.Count)
                {
                    continue;
                }

                if (row == target.Row)
                {
                    for (var col = target.Col + target.Radius; col >= target.Col - target.Radius; col--)
                    {
                        if (col < 0 || col >= matrix[row].Count)
                        {
                            continue;
                        }
                        matrix[row].RemoveAt(col);
                    }
                }
                else
                {
                    if (target.Col < 0 || target.Col >= matrix[row].Count)
                    {
                        continue;
                    }
                    matrix[row].RemoveAt(target.Col);
                }
            }

            for (int row = 0; row < matrix.Count; row++)
            {
                if (matrix[row].Count == 0)
                {
                    matrix.RemoveAt(row);
                    row--;
                }
            }
        }