#NEWLINE# def update( self , bots ) : #NEWLINE# #INDENT# ( px , py ) = self . position #NEWLINE# ( tx , ty ) = self . target #NEWLINE# angle = atan2 ( ( ty - py ) , ( tx - px ) ) #NEWLINE# dx = cos ( angle ) #NEWLINE# dy = sin ( angle ) #NEWLINE# for bot in bots : #NEWLINE# #INDENT# if ( bot == self ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# ( x , y ) = bot . position #NEWLINE# d = ( hypot ( ( px - angle ) , ( py - y ) ) ** 2 ) #NEWLINE# p = ( bot . padding ** 2 ) #NEWLINE# angle = atan2 ( ( py - y ) , ( px - x ) ) #NEWLINE# dx += ( ( cos ( angle ) / d ) * p ) #NEWLINE# dy += ( ( sin ( angle ) / d ) * p ) #NEWLINE# #UNINDENT# angle = atan2 ( dy , dx ) #NEWLINE# magnitude = hypot ( dx , dy ) #NEWLINE# self . angle = angle #NEWLINE# return ( angle , magnitude )