Skip to content

Commit

Permalink
perf(hr): 优化算法 (#71)
Browse files Browse the repository at this point in the history
* perf(hr): 优化算法

* chore: remove log
  • Loading branch information
daflyinbed authored Feb 6, 2024
1 parent c599075 commit 04ec56e
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions src/widgets/HrCalculator/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,23 +69,16 @@ export default defineComponent({
});
function calc() {
const result: Record<number | string, { charIndict: Set<number> }> = {};
const subset = value.bitmap.getSubSet();
for (const [charIndex, c] of props.source.entries()) {
for (const set of c.subset) {
for (const group of subset) {
// 干员的子集中的一个元素 是这个选中的子集中的一个元素 的子集
if ((group & set) !== group) continue;
// 6星要有对应的稀有度tag才能出
if (c.rarity === 5 && !can5(group)) continue;
if (!result[group]) {
result[group] = {
charIndict: new Set(),
};
}
result[group].charIndict.add(charIndex);
if ((value.bitmap.value | set) !== value.bitmap.value) continue;
if (c.rarity === 5 && !can5(set)) continue;
if (!result[set]) {
result[set] = {
charIndict: new Set(),
};
}
result[set].charIndict.add(charIndex);
}
}
const list: Array<{ tags: number; charIndict: number[]; score: number }> =
Expand Down

0 comments on commit 04ec56e

Please sign in to comment.