Jul-28-2019, 05:52 PM
The first thing I think of is to make a list like so:
dists = [(forward, 'forward'), (left, 'left'), ..., (narrow_r3, 'narrow_r3')] dists.sort() closest_dir = dists[0][1]But then there is the question of building the list. Could you convert your calculations into one function with parameters?
directions = (('left', [359, 0, 15]), ('right', [270, 271, 15], ...) distances = [(dist_calc(*parameters), direction) for direction, parameters in direction]
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures