How much a candidate at distance loses for being inside a keepAway radius: 0 when there is no radius or the candidate is outside it, otherwise the shortfall as a negative score.
distance
keepAway
import { keepAwayScore } from '@datamoc/mw_games/ai';console.log(keepAwayScore(1, 3)); // -2, two tiles inside the radiusconsole.log(keepAwayScore(5, 3)); // 0, outside it Copy
import { keepAwayScore } from '@datamoc/mw_games/ai';console.log(keepAwayScore(1, 3)); // -2, two tiles inside the radiusconsole.log(keepAwayScore(5, 3)); // 0, outside it
How much a candidate at
distanceloses for being inside akeepAwayradius: 0 when there is no radius or the candidate is outside it, otherwise the shortfall as a negative score.