import { chooseMove, chooseSwitch, TypeMatrix } from '@datamoc/mw_games/battle';
const matrix = new TypeMatrix();
matrix.set('fire', 'grass', 2);
const moves = [{ type: 'fire' }, { type: 'normal' }];
const best = chooseMove(moves, matrix, ['grass']); // the fire move
const bench = [{ types: ['water'] }, { types: ['grass'] }];
const swapTo = chooseSwitch(['grass'], bench, matrix, ['fire']); // index of the water one
Picks the move whose type is most effective against
opponentTypes, ties keeping the first candidate;nullfor an empty list.