1 """Movement implementation code snippets"""
2
3 __author__ = "B. Henne, F. Ludwig, P. Tute"
4 __contact__ = "henne@dcsec.uni-hannover.de"
5 __copyright__ = "(c) 2010-2011, DCSec, Leibniz Universitaet Hannover, Germany"
6 __license__ = "GPLv3"
7
9 """Randomly finds a new next_node to move to.
10
11 Ignores the last visited node, if possible without getting stuck.
12 Does not set destination_node. Random movement only uses
13 last_node and next_node of a Person.
14 @author: P. Tute"""
15
16 possible_targets = sorted(self.next_node.neighbors.keys())
17 if len(possible_targets) > 1 and self.last_node in possible_targets:
18 possible_targets.remove(self.last_node)
19 self.last_node = self.next_node
20 self.next_node = self._random.choice(possible_targets)
21