sc = game.state.kscmdr
for (i, base) in enumerate(game.state.baseq):
basetbl.append((i, (base - sc).distance()))
sc = game.state.kscmdr
for (i, base) in enumerate(game.state.baseq):
basetbl.append((i, (base - sc).distance()))
basetbl.sort(key=lambda x: x[1])
# look for nearest base without a commander, no Enterprise, and
# without too many Klingons, and not already under attack.
basetbl.sort(key=lambda x: x[1])
# look for nearest base without a commander, no Enterprise, and
# without too many Klingons, and not already under attack.