public static void PrintShortestPath(IShortestPath sp, EdgeWeightedDigraph g, int source, int destination) { // print shortest path for (int t = 0; t < g.V(); t++) { if (t == destination) { break; } if (sp.HasPathTo(t)) { Console.Write("{0} to {1} is {2} ", source, t, sp.DistTo(t)); foreach (var e in sp.PathTo(t)) { Console.Write("[{0}-{1}, {2}] ", e.From(), e.To(), e.Weight()); } Console.WriteLine(); } else { Console.Write("{0} to {1} no path\n", source, t); } } }
} // 0 = determining status, 1 = enemy attack flash, 2 = attacking, 3 = movement flash, 4 = moving //private ILog log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); public Unit(IShortestPath shortestPath) { UnitNumber = _nextUnitNumber; _shortestPath = shortestPath; Selected = false; UnitHasAttackedThisTurn = false; Sleep = false; _nextUnitNumber++; }
public GameBoard(ITerrainMap terrainMap, IUnitList unitList, IShortestPath shortestPath, IAlliedEnemyMatrix alliedEnemyMatrix, IVictoryCalculator victoryCalculator, IEnemyPlan enemyPlan) { _terrainMap = terrainMap; _units = unitList; _shortestPath = shortestPath; _alliedEnemyMatrix = alliedEnemyMatrix; _endOfGame = victoryCalculator; _enemyPlan = enemyPlan; }
public ShortestPathController(IShortestPath path, IHashMapDistances hash, ILocationService locationService, IApplicationService applicationService) { _shortestPath = path; _hashMapDistances = hash; _locationService = locationService; _applicationService = applicationService; try { branches = getArray(); ss = _locationService.PrintArray(); _shortestPath = _shortestPath = new ShortestPath(ss.GetLength(0), getArray()); _hashMapDistances = new HashMapDistances(ss.GetLength(0), getArray()); } catch (Exception ex) { } arr = new int[ss.GetLength(0), ss.GetLength(1)]; for (int i = 0; i < ss.GetLength(0); i++) { for (int y = 0; y < ss.GetLength(1); y++) { int val = 0; if (ss[i, y] != null) { val = Convert.ToInt32(ss[i, y]); } else { val = 0; } arr[i, y] = val; } } }
static string PrintPath(DirectedWeightedGraph g, IShortestPath <DirectedEdge> sp, int startV, int endV) { StringBuilder sb = new StringBuilder(); if (endV == startV) { sb.AppendFormat("{0}->{0} : 0.0", startV); } else if (!sp.HasPathTo(endV)) { sb.AppendFormat("{0}->{1} : No paths", startV, endV); } else { Double len = 0.0; foreach (var edge in sp.PathTo(endV)) { sb.Append(edge.ToString() + ','); len += edge.Weight; } sb.AppendFormat(" : {0}", len); } return(sb.ToString()); }
public ShortestPathController(IShortestPath shortestPath) { _shortestPath = shortestPath; }
public ShortestPathGraphSearch(IShortestPath <TState, TAction> info) { _info = info; }
public ShortestPathGraphSearch(IShortestPath <State, Action> info) { this.info = info; }
public TerrainMap(IShortestPath shortestPath) { _shortestPath = shortestPath; }