mwg API
    Preparing search index...

    Function keepAwayScore

    • 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.

      Parameters

      • distance: number
      • keepAway: number

      Returns number

      import { keepAwayScore } from '@datamoc/mw_games/ai';

      console.log(keepAwayScore(1, 3)); // -2, two tiles inside the radius
      console.log(keepAwayScore(5, 3)); // 0, outside it