• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

samsmithnz / PuzzleSolver / 4219702133

pending completion
4219702133

Pull #42

github

GitHub
Merge 7f70bc7b1 into d250e254c
Pull Request #42: Path finding increase

867 of 920 branches covered (94.24%)

Branch coverage included in aggregate %.

83 of 83 new or added lines in 3 files covered. (100.0%)

1398 of 1418 relevant lines covered (98.59%)

1074771.23 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

93.33
/src/PuzzleSolver/Map/SortedDropZones.cs
1
using SixLabors.ImageSharp.PixelFormats;
2
using System;
3
using System.Collections.Generic;
4
using System.Numerics;
5
using System.Text;
6

7
namespace PuzzleSolver.Map
8
{
9
    public static class SortedDropZones
10
    {
11
        public static List<SortedDropZone> GetSortedDropZones(string[,] map, List<Rgb24> palette)
12
        {
4✔
13
            List<SortedDropZone> sortedDropZones = new List<SortedDropZone>();
4✔
14
            int width = map.GetLength(0);
4✔
15
            int height = map.GetLength(1);
4✔
16
            int totalBorderTiles = (width * 2) + ((height * 2) - 4 - 4);
4✔
17

18
            if (totalBorderTiles < palette.Count)
4!
19
            {
×
20
                throw new Exception("The map isn't big enough to handle this palette. (Map border size of " + width + "x" + height + ", generates " + totalBorderTiles + " border tiles, but we need " + palette.Count + " tiles)");
×
21
            }
22
            int i = 0;
4✔
23
            for (int x = 0; x < width; x++)
52✔
24
            {
22✔
25
                for (int y = 0; y < height; y++)
108✔
26
                {
50✔
27
                    //Find a border tile, that is NOT a corner.
28
                    if ((x == 0 && y != 0 && y != height - 1) ||
50!
29
                        (x == width - 1 && y != 0 && y != height - 1) ||
50✔
30
                        (x == 0 && y != 0 && y != height - 1) ||
50✔
31
                        (x == width - 1 && y != 0 && y != height - 1))
50✔
32
                    {
15✔
33
                        sortedDropZones.Add(new SortedDropZone(palette[i], new Vector2(x, y)));
15✔
34
                        i++;
15✔
35
                    }
15✔
36
                    if (i >= palette.Count)
50✔
37
                    {
18✔
38
                        break;
18✔
39
                    }
40
                }
32✔
41
            }
22✔
42
            return sortedDropZones;
4✔
43
        }
4✔
44
    }
45
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc