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

samsmithnz / PuzzleSolver / 4224594480

pending completion
4224594480

Pull #42

github

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

859 of 910 branches covered (94.4%)

Branch coverage included in aggregate %.

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

1390 of 1409 relevant lines covered (98.65%)

1281874.69 hits per line

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

95.0
/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
        {
5✔
13
            List<SortedDropZone> sortedDropZones = new List<SortedDropZone>();
5✔
14
            int width = map.GetLength(0);
5✔
15
            int height = map.GetLength(1);
5✔
16
            int totalBorderTiles = (width * 2) + ((height * 2) - 4 - 4);
5✔
17

18
            if (totalBorderTiles < palette.Count)
5!
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;
5✔
23
            for (int x = 0; x < width; x++)
68✔
24
            {
29✔
25
                for (int y = 0; y < height; y++)
212✔
26
                {
96✔
27
                    if (i >= palette.Count)
96✔
28
                    {
19✔
29
                        break;
19✔
30
                    }
31
                    //Find a border tile, that is NOT a corner.
32
                    if ((x == 0 && y != 0 && y != height - 1) ||
77✔
33
                        (x == width - 1 && y != 0 && y != height - 1) ||
77✔
34
                        (x != 0 && y == 0 && x != width - 1) ||
77✔
35
                        (x == width - 1 && y == 0 && x != width - 1))
77✔
36
                    {
30✔
37
                        sortedDropZones.Add(new SortedDropZone(palette[i], new Vector2(x, y)));
30✔
38
                        i++;
30✔
39
                    }
30✔
40
                }
77✔
41
            }
29✔
42
            return sortedDropZones;
5✔
43
        }
5✔
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