mwg API
    Preparing search index...

    Function defaultWeigh

    • The default stage weight: each factor times the aspect of the same name (an unset aspect weighs 1, so a factor on its own is not erased), minus a keepAwayScore penalty for a candidate's distance.

      Type Parameters

      • A

      Parameters

      Returns number

      import { Aspects, defaultWeigh } from '@datamoc/mw_games/ai';

      const score = defaultWeigh(
      { id: 'charge', action: {}, factors: { aggression: 3 } },
      { aspects: new Aspects({ aggression: 2 }) },
      );
      console.log(score); // 6