Chris Angelico <ros...@gmail.com>: > Call this a code review request, if you like. I'm wondering how you'd > go about coding something like this.
As a simple layout question, I'd do it like this: ======================================================================== if mode == "Brake2": # Already got the brakes fully on distance_to_full_braking_power = 0.0 speed_full_brake = curspeed elif mode == "Brake1": # The brakes went on one second ago, they're nearly full distance_to_full_braking_power = curspeed - 0.2125 speed_full_brake = curspeed - 0.425 else: # Brakes aren't on. distance_to_full_braking_power = (curspeed - 0.1) + (curspeed - 0.4125) speed_full_brake = curspeed - 0.625 # If we hit the brakes now (or already have hit them), we'll go another # d meters and be going at s m/s before reaching full braking power. ======================================================================== Marko -- https://mail.python.org/mailman/listinfo/python-list