Beispiel #1
0
def _find_best_unknown_reference(life, ref_type):
	_best_reference = {'reference': None, 'score': -1}
	
	for reference in WORLD_INFO['reference_map'][ref_type]:
		_score = judgement.judge_reference(life, reference, known_penalty=True)
		
		if not _score:
			continue
		
		_chunk_key = find_nearest_key_in_reference(life, reference)
		
		if numbers.distance(life['pos'], maps.get_chunk(_chunk_key)['pos'])/WORLD_INFO['chunk_size']>10:
			continue
		
		if not _best_reference['reference'] or _score>_best_reference['score']:
			_best_reference['score'] = _score
			_best_reference['reference'] = reference
			_best_reference['chunk_key'] = _chunk_key
	
	return _best_reference
Beispiel #2
0
def _find_best_unknown_reference(life, ref_type):
    _best_reference = {"reference": None, "score": -1}

    for reference in WORLD_INFO["reference_map"][ref_type]:
        _score = judgement.judge_reference(life, reference, known_penalty=True)

        if not _score:
            continue

            # TODO: We do this twice (check in path_along_reference). Not good!
        if (
            numbers.distance(life["pos"], maps.get_chunk(find_nearest_key_in_reference(life, reference))["pos"])
            / WORLD_INFO["chunk_size"]
            > 10
        ):
            continue

        if not _best_reference["reference"] or _score > _best_reference["score"]:
            _best_reference["score"] = _score
            _best_reference["reference"] = reference

    return _best_reference