15 lines
		
	
	
		
			485 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			15 lines
		
	
	
		
			485 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| from nullptr.analyzer import solve_tsp
 | |
| from random import randrange
 | |
| 
 | |
| def assign_probe(c, s):   
 | |
|   system = s.location.system
 | |
|   m = [m.waypoint for m in c.store.all_members(system, 'Marketplace')]
 | |
|   m = solve_tsp(c, m)
 | |
|   hops = [w.symbol for w in m]
 | |
|   start_hop = randrange(0, len(hops))
 | |
|   s.log(f'Assigning {s} to probe {len(hops)} starting at {hops[start_hop]}')
 | |
|   
 | |
|   c.captain.init_mission(s, 'probe')
 | |
|   c.captain.smipa(s, 'hops', hops)
 | |
|   c.captain.smipa(s, 'next-hop', start_hop)
 | |
|    | 
