def simulate(player): L = lift_force(player) _mag = mag(player[2], player[3]) # f = drag_narrow + (drag_flat-drag_narrow) * abs(sin(self.AoA)) f = drag_narrow player[2] += (L[0] - f * _mag * player[2]) / mass player[3] += (L[1] - g * mass - f * _mag * player[3]) / mass player[0] += player[2] * timedelta player[1] -= player[3] * timedelta player[7] += timedelta
def remap(variables): return [ variables[0], # x variables[1], # y pmag(variables), # mag direction(variables), # dir variables[4], # theta mag( variables[5] - variables[0], variables[6] - variables[1] ), # distance to target atan2( variables[6] - variables[1], variables[5] - variables[0] ), # angle to target variables[5] - variables[0], # horizontal distance to target variables[6] - variables[1], # vertical distance to target variables[7], # time ]
def dist(self, sele1, sele2): return mag(self.center(**sele1) - self.center(**sele2))
def numdist(numa1, numa2): return mag(numa1.center() - numa2.center())
def fitness_formula(x, y, tx, ty, time): return ( FITNESS_HYPERPARAMETER_HEIGHT * exp(-((mag(tx - x, ty - y) / FITNESS_HYPERPARAMETER_WIDTH) ** 2)) - 2 * time )
def pmag(player): return mag(player[2], player[3])