Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf(hr): 优化算法 #71

Merged
merged 2 commits into from
Feb 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading