Kaynağa Gözat

removing debug lines, fixing spacing

tarfeef101 6 yıl önce
ebeveyn
işleme
43b534a2da
1 değiştirilmiş dosya ile 3 ekleme ve 6 silme
  1. 3 6
      a3/router.py

+ 3 - 6
a3/router.py

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