Statistics
| Revision:

## root / trunk / code / projects / traffic_navigation / mapping.c @ 1950

 1 ```#include "mapping.h" ``` ```#include "lineDrive.h" ``` ```#include ``` ```//The last intersection that we encountered ``` ```int lastInt; ``` ```//Current encoder reading ``` ```int distance; ``` ```/* ``` ``` * Traverses the map using DFS ``` ``` * Returns 0 if all of the intersections in the database were seen ``` ``` * 1 otherwise ``` ``` */ ``` ```int createMap(){ ``` ``` ``` ``` int seen = 0 ``` ``` int currInt = 0; ``` ``` int barcode; ``` ``` int outEdges; ``` ``` struct node currInt; ``` ``` int i; ``` ``` ``` ``` /* Holds the number of intersections we have seen */ ``` ``` char[] intseen; ``` ``` /* Drives to the nearest intersection */ ``` ``` barcode = nextInt(); ``` ``` ``` ``` while(seen < numIntersections) ``` ``` { ``` ``` /* Given the barcode reading, returns the struct representing ``` ``` * the intersection */ ``` ``` currInt = lookup(barcode); ``` ``` ``` ``` /* Update the nodes that you have seen */ ``` ``` intseen[currInt] = 1; ``` ``` ``` ``` outEdges = currInt.numOut; ``` ``` //Go through every outgoing edge ``` ``` for(i = 0; i< outEdges; i++) ``` ``` { ``` ``` //Step out ``` ``` } ``` ``` } ``` ``` return 0; ``` ```} ``` ```/* Creates an edge in the graph */ ``` ```int insertEdge(){ ``` ```} ``` ```/* ``` ``` * Drives to the next intersection and returns its ID ``` ``` * If we are at a dead end, returns -1 ``` ``` */ ``` ```int nextInt(){ ``` ``` ``` ```} ```