scanning_for_all_aims.py 1.2 KB
 Ahmad Reza committed Mar 01, 2019 1 2 3 4 ``````""" This solution just scans for particles that are within 5 hops range and prints them out. """ `````` Ahmad Reza committed Jul 16, 2019 5 ``````#Standard Lib that has to be in each solution `````` Ahmad Reza committed Sep 18, 2019 6 ``````from lib.swarm_sim_headerimport import * `````` Ahmad Reza committed Mar 01, 2019 7 `````` `````` Ahmad Reza committed Aug 13, 2019 8 ``````def solution(world): `````` Ahmad Reza committed Mar 01, 2019 9 10 `````` all_matters_list=[] `````` Ahmad Reza committed Aug 13, 2019 11 `````` if world.get_actual_round() == 1: `````` Ahmad Reza committed Sep 02, 2019 12 `````` all_matters_list=world.get_particle_map_coords()[(0,0)].scan_for_matters_within(hop=5) `````` Ahmad Reza committed Mar 01, 2019 13 14 15 16 17 `````` for list in all_matters_list: if list.type=='particle': print ("particle at", list.coords) elif list.type=='tile': print("tile", list.coords) `````` Ahmad Reza committed Jun 04, 2019 18 19 `````` elif list.type=='marker': print("marker", list.coords) `````` Ahmad Reza committed Sep 02, 2019 20 21 22 23 24 25 26 27 28 29 `````` if world.get_actual_round() == 2: all_matters_list = world.get_particle_map_coords()[(0, 0)].scan_for_particles_within(hop=5) for list in all_matters_list: print ("particle at", list.coords) all_matters_list = world.get_particle_map_coords()[(0, 0)].scan_for_tiles_within(hop=5) for list in all_matters_list: print("tile", list.coords) all_matters_list = world.get_particle_map_coords()[(0, 0)].scan_for_markers_within(hop=5) for list in all_matters_list: print("marker", list.coords)``````