Esempio n. 1
0
short search(){
	printf("SEARCHING\n");
	short nodes[4][3]={{0,0,0},{0,0,0},{0,0,0},{0,0,0}};
	short x = position[0];
	short y = position[1];
	//map[x][y+6][0] = Robot_GetIntersections(); //Kreuzung erhalten

	unsigned short intersection = mapIntersection(x, y + 6);

	fillNodes(nodes, intersection/16); //Knoten füllen
	fillUsed(nodes); //existierende Knoten auf "besucht" testen
	map[x][y+6][1] = 2; //Kreuzung auf "besucht" stellen
	if (findWay(nodes) == 1){  //Weg finden
		return 1;
	}


	return 0;
}
void intersectionOfMatchResults(const std::vector<MatchResult>& forward,
                                const std::vector<MatchResult>& reverse,
                                std::vector<MatchResult>& matches) {
  // Convert to maps.
  std::map<Match, double> forward_set;
  std::map<Match, double> reverse_set;
  std::transform(forward.begin(), forward.end(),
      std::inserter(forward_set, forward_set.begin()), matchResultToPair);
  std::transform(reverse.begin(), reverse.end(),
      std::inserter(reverse_set, reverse_set.begin()), matchResultToPair);

  // Take intersection of maps.
  std::map<Match, double> match_set;
  mapIntersection(forward_set.begin(), forward_set.end(), reverse_set.begin(),
      reverse_set.end(), std::inserter(match_set, match_set.begin()));

  // Convert to list.
  matches.clear();
  std::transform(match_set.begin(), match_set.end(),
      std::back_inserter(matches), pairToMatchResult);
}