def alignment(self, d=<NUM_LIT:5>):
vx = vy = vz = <NUM_LIT:0><EOL>for b in self.boids:<EOL><INDENT>if b != self:<EOL><INDENT>vx, vy, vz = vx+b.vx, vy+b.vy, vz+b.vz<EOL><DEDENT><DEDENT>n = len(self.boids)-<NUM_LIT:1><EOL>vx, vy, vz = vx/n, vy/n, vz/n<EOL>return (vx-self.vx)/d, (vy-self.vy)/d, (vz-self.vz)/d<EOL>
Boids match velocity with other boids.