implemented pathfinder in c#