Sensor Networks Assignment 2 Hints
From Ece
Hints for Assignment 2
Sensor Network Simulation 2B, 2C
- When passing around the path lists via
replicate, you may get all of the nodes pointing to the same copy of data. This is due to the way thereplicatefunction is currently written. If it is just a number (likehops), then it copies over the value correctly, but for more complex objects like lists, it returns a pointer instead, and all of them get set to the SAME pointer. So the best workaround is to create a new list, and loop over the values inself.path, append them to the new list, append the last value (self.host.id) to the new list, and put THAT list into the dictionary that is passed into thereplicatefunction.
Sensor Network Simulation 2C
- To run two programs on separate nodes, just type the desired program name in twice in the commmand line.




