rendered paste body def updateOwnership(self): previousFrame = 1 for x in self.presence: print "Parsing presence " + str(x) y = 0 while (y + 1) < len(self.own): if self.own[y][1] == self.own[y + 1][1]: self.own[y][0] += self.own[y + 1][0] self.own.pop(y + 1) y += 1 totalSum = 0 y = 0 while y < len(self.own): print totalSum if x[0] < (totalSum + self.own[y][0]): if not (self.own[y][1] == x[1]): print "Overtaking..." self.own.insert(y + 1, totalSum + self.own[y][0] - x[0]) self.own.insert(y + 1, [0, x[1]]) self.own[y][0] = x[0] - totalSum y += 1 print "Hacking at next ownership..." self.own[y][0] += x[2] / previousFrame z = int((y + 1) % len(self.own)) self.own[z][0] -= x[2] / previousFrame while self.own[z] <= 0: self.own[(z + 1) % len(self.own)] += self.own[z] self.own.pop(z) z = int((z + 1) % len(self.own)) break totalSum += self.own[y][0] y += 1 y = 0 totalSum = 0 while y < len(self.own): if (2 * pi) < (totalSum + self.own[y][0]): self.own.insert(0, [totalSum + self.own[y][0] - (2 * pi)]) self.own[y][0] = (2 * pi) - totalSum totalSum += self.own[y][0] y += 1 if not (totalSum == (2 * pi)): print "Angle mismatch!"