fix : TAN logic is done (normal,field and BOX)
This commit is contained in:
parent
563e208a64
commit
37e066d0fb
@ -148,9 +148,6 @@ export class SelectionService {
|
|||||||
const group1 = dashIndices.length > 0 ? numbers.slice(0, dashIndices[0]) : numbers;
|
const group1 = dashIndices.length > 0 ? numbers.slice(0, dashIndices[0]) : numbers;
|
||||||
const group2 = dashIndices.length > 0 ? numbers.slice(dashIndices[0] + 1, dashIndices[1] || numbers.length) : [];
|
const group2 = dashIndices.length > 0 ? numbers.slice(dashIndices[0] + 1, dashIndices[1] || numbers.length) : [];
|
||||||
const group3 = dashIndices.length > 1 ? numbers.slice(dashIndices[1] + 1) : [];
|
const group3 = dashIndices.length > 1 ? numbers.slice(dashIndices[1] + 1) : [];
|
||||||
const group1Count = group1.includes('F') ? 12 : group1.filter(n => typeof n === 'number').length;
|
|
||||||
const group2Count = group2.includes('F') ? 12 : group2.filter(n => typeof n === 'number').length;
|
|
||||||
const group3Count = group3.includes('F') ? 12 : group3.filter(n => typeof n === 'number').length;
|
|
||||||
|
|
||||||
let combinations = 0;
|
let combinations = 0;
|
||||||
|
|
||||||
@ -162,60 +159,23 @@ export class SelectionService {
|
|||||||
combinations = allNums.length >= 3 ? this.calculatePermutationsN(allNums.length, 3) : 0;
|
combinations = allNums.length >= 3 ? this.calculatePermutationsN(allNums.length, 3) : 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (group1.includes('F') && group2.includes('F') && group3.includes('F')) {
|
// Define possible values for each group: 'F' means all runners (1 to 12), else only selected numbers
|
||||||
combinations = 12 * 11 * 10; // nP3
|
const runners = Array.from({ length: 12 }, (_, i) => i + 1);
|
||||||
} else if (group1.includes('F') || group2.includes('F') || group3.includes('F')) {
|
const group1Vals = group1.includes('F') ? runners : group1.filter(n => typeof n === 'number') as number[];
|
||||||
const counts = [group1Count, group2Count, group3Count];
|
const group2Vals = group2.includes('F') ? runners : group2.filter(n => typeof n === 'number') as number[];
|
||||||
combinations = counts.reduce((acc, count) => acc * count, 1);
|
const group3Vals = group3.includes('F') ? runners : group3.filter(n => typeof n === 'number') as number[];
|
||||||
if (group1.includes('F') && !group2.includes('F') && !group3.includes('F')) {
|
|
||||||
const numGroup2 = group2.filter(n => typeof n === 'number') as number[];
|
|
||||||
const numGroup3 = group3.filter(n => typeof n === 'number') as number[];
|
|
||||||
combinations = 0;
|
combinations = 0;
|
||||||
for (let i = 1; i <= 12; i++) {
|
for (const i of group1Vals) {
|
||||||
for (const j of numGroup2) {
|
for (const j of group2Vals) {
|
||||||
for (const k of numGroup3) {
|
if (i === j) continue;
|
||||||
if (i !== j && i !== k && j !== k) combinations++;
|
for (const k of group3Vals) {
|
||||||
}
|
if (i === k || j === k) continue;
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (group2.includes('F') && !group1.includes('F') && !group3.includes('F')) {
|
|
||||||
const numGroup1 = group1.filter(n => typeof n === 'number') as number[];
|
|
||||||
const numGroup3 = group3.filter(n => typeof n === 'number') as number[];
|
|
||||||
combinations = 0;
|
|
||||||
for (const i of numGroup1) {
|
|
||||||
for (let j = 1; j <= 12; j++) {
|
|
||||||
for (const k of numGroup3) {
|
|
||||||
if (i !== j && i !== k && j !== k) combinations++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (group3.includes('F') && !group1.includes('F') && !group2.includes('F')) {
|
|
||||||
const numGroup1 = group1.filter(n => typeof n === 'number') as number[];
|
|
||||||
const numGroup2 = group2.filter(n => typeof n === 'number') as number[];
|
|
||||||
combinations = 0;
|
|
||||||
for (const i of numGroup1) {
|
|
||||||
for (const j of numGroup2) {
|
|
||||||
for (let k = 1; k <= 12; k++) {
|
|
||||||
if (i !== j && i !== k && j !== k) combinations++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
const numGroup1 = group1.filter(n => typeof n === 'number') as number[];
|
|
||||||
const numGroup2 = group2.filter(n => typeof n === 'number') as number[];
|
|
||||||
const numGroup3 = group3.filter(n => typeof n === 'number') as number[];
|
|
||||||
for (const a of numGroup1) {
|
|
||||||
for (const b of numGroup2) {
|
|
||||||
if (b === a) continue;
|
|
||||||
for (const c of numGroup3) {
|
|
||||||
if (c === a || c === b) continue;
|
|
||||||
combinations++;
|
combinations++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
updated.numbers = [...group1, ...(group2.length ? ['-', ...group2] : []), ...(group3.length ? ['-', ...group3] : [])];
|
updated.numbers = [...group1, ...(group2.length ? ['-', ...group2] : []), ...(group3.length ? ['-', ...group3] : [])];
|
||||||
updated.total = combinations * value * 10;
|
updated.total = combinations * value * 10;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user