Browse Source

removing debug lines, fixing spacing

tarfeef101 6 years ago
parent
commit
43b534a2da
1 changed files with 3 additions and 6 deletions
  1. 3 6
      a3/router.py

+ 3 - 6
a3/router.py

@@ -65,7 +65,7 @@ class connection:
         this.cost = cost
         this.cost = cost
         
         
     def show(this):
     def show(this):
-        log.write("Link: " + str(this.sender) + " " + str(this.src) + " " + str(this.link) + " " + str(this.cost))
+        log.write("Link: " + str(this.sender) + " " + str(this.src) + " " + str(this.link) + " " + str(this.cost) + '\n')
         
         
     # infers what this connection's (link's) destination is
     # infers what this connection's (link's) destination is
     def infer(this, db):
     def infer(this, db):
@@ -101,20 +101,17 @@ class db:
         for i in this.entries[src - 1]:
         for i in this.entries[src - 1]:
             # dupe entry
             # dupe entry
             if (connection.link == i.link):
             if (connection.link == i.link):
-                log.write("This was a duplicate packet. Ignoring.")
+                log.write("This was a duplicate packet. Ignoring." + '\n')
                 return False
                 return False
         # not a dupe, insert
         # not a dupe, insert
         this.entries[src - 1].append(connection)
         this.entries[src - 1].append(connection)
         this.show()
         this.show()
         # update entries and connection to contain
         # update entries and connection to contain
         got_dest = connection.infer(this)
         got_dest = connection.infer(this)
-        print("GOT_DEST + ", got_dest)
         # insert into graph if we have the endpoints for this edge
         # insert into graph if we have the endpoints for this edge
         if (got_dest):
         if (got_dest):
             graph.insert(connection)
             graph.insert(connection)
-            print("DONE INSERT")
             graph.rebuild()
             graph.rebuild()
-            print("DONE REBUILD")
             graph.show()
             graph.show()
         # notify neighbours
         # notify neighbours
         notify(connection)
         notify(connection)
@@ -150,7 +147,7 @@ class graph:
         
         
         # set the adjacent node for each node
         # set the adjacent node for each node
         for i in range(0, 5):
         for i in range(0, 5):
-            this.sssp[i - 1] = (this.sssp[i - 1][0], i)
+            this.sssp[i] = (this.sssp[i][0], i)
         this.sssp[rid - 1] = (0, rid - 1)
         this.sssp[rid - 1] = (0, rid - 1)
         
         
         curnode = rid - 1
         curnode = rid - 1