fix: add missing comments to "Recursion.LD_24"
This commit is contained in:
parent
cc1c7a4ab1
commit
d9664e0555
@ -8,6 +8,11 @@ namespace LD_24.Code
|
|||||||
|
|
||||||
public static class TaskUtils
|
public static class TaskUtils
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Finds the best possible pizzeria for the given map for the friends to meet up
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="map">Target map</param>
|
||||||
|
/// <returns>Best pizzeria result object</returns>
|
||||||
public static BestPizzeriaResult FindBestPizzeria(Map map)
|
public static BestPizzeriaResult FindBestPizzeria(Map map)
|
||||||
{
|
{
|
||||||
int lowestCost = int.MaxValue;
|
int lowestCost = int.MaxValue;
|
||||||
@ -60,11 +65,27 @@ namespace LD_24.Code
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Finds the minimum distance between 2 points on map.
|
||||||
|
/// Returns -1, if there is no path
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="map">Target map</param>
|
||||||
|
/// <param name="from">From positions</param>
|
||||||
|
/// <param name="to">To position</param>
|
||||||
|
/// <returns>Minimum distance</returns>
|
||||||
public static int FindBestPath(Map map, Point from, Point to)
|
public static int FindBestPath(Map map, Point from, Point to)
|
||||||
{
|
{
|
||||||
return FindBestPath(map, from, to, new Stack<Point>());
|
return FindBestPath(map, from, to, new Stack<Point>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Finds the minimum distance between 2 points on map.
|
||||||
|
/// Returns -1, if there is no path
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="map">Target map</param>
|
||||||
|
/// <param name="from">From positions</param>
|
||||||
|
/// <param name="to">To position</param>
|
||||||
|
/// <returns>Minimum distance</returns>
|
||||||
private static int FindBestPath(Map map, Point from, Point to, Stack<Point> exploredPoints)
|
private static int FindBestPath(Map map, Point from, Point to, Stack<Point> exploredPoints)
|
||||||
{
|
{
|
||||||
if (from.Equals(to)) { return 0; }
|
if (from.Equals(to)) { return 0; }
|
||||||
@ -92,6 +113,13 @@ namespace LD_24.Code
|
|||||||
return minCost;
|
return minCost;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns walkable neighbours around a given point
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="map">Target map</param>
|
||||||
|
/// <param name="x">Target x</param>
|
||||||
|
/// <param name="y">Target y</param>
|
||||||
|
/// <returns></returns>
|
||||||
private static IEnumerable<Point> GetNeighbours(Map map, int x, int y)
|
private static IEnumerable<Point> GetNeighbours(Map map, int x, int y)
|
||||||
{
|
{
|
||||||
if (map.IsInBounds(x + 1, y) && map.Get(x + 1, y) != MapTile.Wall)
|
if (map.IsInBounds(x + 1, y) && map.Get(x + 1, y) != MapTile.Wall)
|
||||||
|
Loading…
Reference in New Issue
Block a user