def _get_nearest_known_camp(life):
	_nearest_camp = {'camp': None, 'score': -1}
	
	for camp in [life['known_camps'][i] for i in life['known_camps']]:
		_key = references.find_nearest_key_in_reference(life, get_camp(camp['id'])['reference'])
		_center = [int(val)+(WORLD_INFO['chunk_size']/2) for val in _key.split(',')]
		
		_distance = numbers.distance(life['pos'], _center)
		
		if not _nearest_camp['camp'] or _distance>_nearest_camp['score']:
			_nearest_camp['camp'] = camp
			_nearest_camp['score'] = _distance
	
	return _nearest_camp
dataset/ETHPy150Open flags/Reactor-3/alife/camps.py/_get_nearest_known_camp/original