def find_best_chunk(life, ignore_starting=False, ignore_time=False, lost_method=None, only_unvisted=False, only_unseen=False, only_recent=False):
	_interesting_chunks = {}
	
	for chunk_key in life['known_chunks']:
		_chunk = life['known_chunks'][chunk_key]
		
		if not ignore_time and (_chunk['last_visited'] == -1 or time.time()-_chunk['last_visited']<=400):
			if only_unvisted and not _chunk['last_visited'] == -1:
				continue
			
			if only_unseen and not _chunk['last_seen'] == -1:
				continue
			
			_interesting_chunks[chunk_key] = life['known_chunks'][chunk_key]
		elif ignore_time:
			if only_unvisted and not _chunk['last_visited'] == -1:
				continue
			
			if only_unseen and not _chunk['last_seen'] == -1:
				continue
			
			_interesting_chunks[chunk_key] = life['known_chunks'][chunk_key]
	
	if not ignore_starting:
		_current_known_chunk = lfe.get_current_known_chunk(life)
		_initial_score = _current_known_chunk['score']
	else:
		_current_known_chunk = None
		_initial_score = 0
	
	if only_recent:
		_recent = -1
		for chunk_key in _interesting_chunks.keys():
			chunk = _interesting_chunks[chunk_key]
			
			if chunk['discovered_at']>_recent:
				_recent = chunk['discovered_at']
	
	_best_chunk = {'score': _initial_score, 'chunk_key': lfe.get_current_chunk_id(life)}
	for chunk_key in _interesting_chunks:
		chunk = _interesting_chunks[chunk_key]
		_score = chunk['score']

		if only_recent:
			if chunk['discovered_at']<_recent:
				continue
		
		if lost_method == 'furthest':
			chunk_center = [int(val)+(WORLD_INFO['chunk_size']/2) for val in chunk_key.split(',')]
			_score = numbers.distance(life['pos'], chunk_center)
			
			if ignore_starting and chunk_key == lfe.get_current_chunk_id(life):
				continue
		
		if _score>_best_chunk['score']:
			_best_chunk['score'] = _score
			_best_chunk['chunk_key'] = chunk_key
		
	if not _best_chunk['chunk_key'] or not _best_chunk['score']:
		return False
	
	return _best_chunk['chunk_key']

#def find_best_unknown_chunk(life, chunks):
#	_nearest = {'distance': -1, 'key': None}
#	for chunk_key in references.find_nearest_road(life):
#		if chunk_key in life['known_chunks']:
#			continue
#		
#		chunk_center = [int(val)+(WORLD_INFO['chunk_size']/2) for val in chunk_key.split(',')]
#		_distance = numbers.distance(life['pos'], chunk_center)
#		
#		if not _nearest['key'] or _distance<_nearest['distance']:
#			_nearest['distance'] = _distance
#			_nearest['key'] = chunk_key
#	
#	return _nearest['key']
dataset/ETHPy150Open flags/Reactor-3/alife/chunks.py/find_best_chunk/original