Example #1
0
    public static void Main()
    {
        galaxy = new Galaxy(Console.ReadLine().SplitBy(" "));

        var position = string.Empty;

        while ((position = Console.ReadLine()) != "Let the Force be with you")
        {
            var hero = new AvatarPoint(position.SplitBy(" "));
            var evil = new AvatarPoint(Console.ReadLine().SplitBy(" "));

            while (evil.Col >= 0 && evil.Row >= 0)
            {
                if (IsValidPositionInThisGalaxy(evil))
                {
                    galaxy.SetAtPosition(evil.Row, evil.Col, 0);
                }

                evil.Next(-1, -1);
            }

            while (hero.Col < galaxy.Dimensions.Col && hero.Row >= 0)
            {
                if (IsValidPositionInThisGalaxy(hero))
                {
                    sumStarsValues += galaxy.GetValue(hero.Row, hero.Col);
                }
                hero.Next(-1, 1);
            }
        }

        Console.WriteLine(sumStarsValues);
    }