src/core/Feature.js
/**
	* Computes a score between 0 and 1 based on the bot's closeness to the given item.
	* The further the item, the higher the rating. If there is no item of the given type
	* present in the game world at the time this method is called the value returned is 1.
	*
	* @param {Enemy} enemy - The enemy this score is computed for.
	* @param {Number} itemType - The type of the item.
	* @return {Number} The distance score.
	*/
Computes a score between 0 and 1 based on the bot's closeness to the given item.
The further the item, the higher the rating. If there is no item of the given type
present in the game world at the time this method is called the value returned is 1.

@param {Enemy} enemy - The enemy this score is computed for.
@param {Number} itemType - The type of the item.
@return {Number} The distance score.
Computes a score between 0 and 1 based on the bot ' s closeness to the given item . The further the item the higher the rating . If there is no item of the given type present in the game world at the time this method is called the value returned is 1 . @param { Enemy } enemy - The enemy this score is computed for . @param { Number } itemType - The type of the item . @return { Number } The distance score .
static distanceToItem( enemy, itemType ) {
		let score = 1;
		enemy.world.getClosestItem( enemy, itemType, result );
		if ( result.item ) {
			let distance = result.distance;
			distance = MathUtils.clamp( distance, CONFIG.BOT.MIN_ITEM_RANGE, CONFIG.BOT.MAX_ITEM_RANGE );
			score = distance / CONFIG.BOT.MAX_ITEM_RANGE;
		}
		return score;
	}
static distanceToItem ( enemy , itemType ) { let score = 1 ; enemy . world . getClosestItem ( enemy , itemType , result ) ; if ( result . item ) { let distance = result . distance ; distance = MathUtils . clamp ( distance , CONFIG . BOT . MIN_ITEM_RANGE , CONFIG . BOT . MAX_ITEM_RANGE ) ; score = distance / CONFIG . BOT . MAX_ITEM_RANGE ; } return score ; }
Computes a score between 0 and 1 based on the bot's closeness to the given item.
Computes a score between 0 and 1 based on the bot ' s closeness to the given item .