docs: function getMaterialDiff(pieces) {
      const diff = {
        white: {
          king: 0, queen: 0, rook: 0, bishop: 0, knight: 0, pawn: 0,
        },
        black: {
          king: 0, queen: 0, rook: 0, bishop: 0, knight: 0, pawn: 0,
        },
      };
  
      Object.keys(pieces).forEach((k) => {
        const p = pieces[k];
        const them = diff[opposite(p.color)];
        const i = 1;
        if (them[p.role] > 0) {
          them[p.role] -= i;
        } else {
          diff[p.color][p.role] += i;
        }
      });
  
      return diff;
    }