Click here to Skip to main content
15,892,480 members
Articles / Programming Languages / C# 4.0

A Complex - Yet Quite Intelligible - Pathfinding in C#

Rate me:
Please Sign up or sign in to vote.
4.96/5 (41 votes)
30 Aug 2013CPOL21 min read 59.8K   2.5K   88  
A semi-analytic 2D path-finding for large dynamic scenarios.
using System;
using System.Drawing;
using YinYang.CodeProject.Projects.SimplePathfinding.PathFinders.Common;

namespace YinYang.CodeProject.Projects.SimplePathfinding.PathFinders.BreadthFirst
{
    public class BreadthFirstPathfinder : BaseGraphSearchPathfinder<SimpleNode, BreadthFirstMap>
    {
        #region | Constructors |

        public BreadthFirstPathfinder(Int32 width, Int32 height) : base(width, height) { }

        #endregion

        #region << DijkstraPathfinder >>

        /// <summary>
        /// See <see cref="BaseGraphSearchPathfinder{TNode,TMap}.OnPerformAlgorithm"/> for more details.
        /// </summary>
        protected override void OnPerformAlgorithm(SimpleNode currentNode, SimpleNode neighborNode, Point neighborPoint, Point endPoint)
        {
            if (neighborNode == null)
            {
                Map.OpenNode(neighborPoint, currentNode);
            }
        }

        #endregion
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Czech Republic Czech Republic
Contacts: EMAIL - smartk8@gmail.com

Comments and Discussions