fix : every logic for (TAN,QUI & FOR ) are working.
This commit is contained in:
parent
0fdb069433
commit
e2673edbfa
@ -87,11 +87,18 @@ export class SelectionService {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const group1Count = group1.includes('F') ? this.runnerCount : group1.filter(n => typeof n === 'number').length;
|
||||
const group2Count = group2.includes('F') ? this.runnerCount : group2.filter(n => typeof n === 'number').length;
|
||||
combinations = isBoxed
|
||||
? this.calculatePermutations(group1Count + group2Count)
|
||||
: group1Count * group2Count;
|
||||
const group1Numbers = group1.includes('F') ? Array.from({ length: this.runnerCount }, (_, i) => i + 1) : group1.filter(n => typeof n === 'number') as number[];
|
||||
const group2Numbers = group2.includes('F') ? Array.from({ length: this.runnerCount }, (_, i) => i + 1) : group2.filter(n => typeof n === 'number') as number[];
|
||||
if (isBoxed) {
|
||||
const allNumbers = [...new Set([...group1Numbers, ...group2Numbers])];
|
||||
combinations = this.calculatePermutations(allNumbers.length);
|
||||
} else {
|
||||
for (const a of group1Numbers) {
|
||||
for (const b of group2Numbers) {
|
||||
if (a !== b) combinations++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
updated.numbers = [...group1, '-', ...group2];
|
||||
@ -119,11 +126,22 @@ export class SelectionService {
|
||||
}
|
||||
combinations = pairSet.size;
|
||||
} else {
|
||||
const group1Count = group1.includes('F') ? this.runnerCount : group1.filter(n => typeof n === 'number').length;
|
||||
const group2Count = group2.includes('F') ? this.runnerCount : group2.filter(n => typeof n === 'number').length;
|
||||
combinations = isBoxed
|
||||
? this.calculateCombinations(group1Count + group2Count)
|
||||
: group1Count * group2Count;
|
||||
const group1Numbers = group1.includes('F') ? Array.from({ length: this.runnerCount }, (_, i) => i + 1) : group1.filter(n => typeof n === 'number') as number[];
|
||||
const group2Numbers = group2.includes('F') ? Array.from({ length: this.runnerCount }, (_, i) => i + 1) : group2.filter(n => typeof n === 'number') as number[];
|
||||
if (isBoxed) {
|
||||
const allNumbers = [...new Set([...group1Numbers, ...group2Numbers])];
|
||||
combinations = this.calculateCombinations(allNumbers.length);
|
||||
} else {
|
||||
const pairSet = new Set<string>();
|
||||
for (const a of group1Numbers) {
|
||||
for (const b of group2Numbers) {
|
||||
if (a === b) continue;
|
||||
const key = a < b ? `${a},${b}` : `${b},${a}`;
|
||||
pairSet.add(key);
|
||||
}
|
||||
}
|
||||
combinations = pairSet.size;
|
||||
}
|
||||
}
|
||||
|
||||
updated.numbers = [...group1, '-', ...group2];
|
||||
@ -156,9 +174,23 @@ export class SelectionService {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
combinations = isBoxed
|
||||
? this.calculatePermutationsN(numbers.includes('F') ? this.runnerCount : numbers.filter(n => typeof n === 'number').length, 3)
|
||||
: this.runnerCount * this.runnerCount * this.runnerCount;
|
||||
const group1Numbers = group1.includes('F') ? Array.from({ length: this.runnerCount }, (_, i) => i + 1) : group1.filter(n => typeof n === 'number') as number[];
|
||||
const group2Numbers = group2.includes('F') ? Array.from({ length: this.runnerCount }, (_, i) => i + 1) : group2.filter(n => typeof n === 'number') as number[];
|
||||
const group3Numbers = group3.includes('F') ? Array.from({ length: this.runnerCount }, (_, i) => i + 1) : group3.filter(n => typeof n === 'number') as number[];
|
||||
if (isBoxed) {
|
||||
const allNumbers = [...new Set([...group1Numbers, ...group2Numbers, ...group3Numbers])];
|
||||
combinations = this.calculatePermutationsN(allNumbers.length, 3);
|
||||
} else {
|
||||
for (const i of group1Numbers) {
|
||||
for (const j of group2Numbers) {
|
||||
if (i === j) continue;
|
||||
for (const k of group3Numbers) {
|
||||
if (i === k || j === k) continue;
|
||||
combinations++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
updated.numbers = [...group1, '-', ...group2, '-', ...group3];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user