powerball-quantum 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +80 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +76 -0
- package/dist/data.d.ts +17 -0
- package/dist/data.js +116 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.js +110 -0
- package/dist/quantum.d.ts +45 -0
- package/dist/quantum.js +239 -0
- package/dist/types.d.ts +27 -0
- package/dist/types.js +6 -0
- package/package.json +41 -0
- package/powerball_data.csv +1880 -0
- package/src/cli.ts +82 -0
- package/src/data.ts +83 -0
- package/src/index.ts +142 -0
- package/src/quantum.ts +277 -0
- package/src/types.ts +25 -0
- package/tsconfig.json +17 -0
package/README.md
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# powerball-quantum
|
|
2
|
+
|
|
3
|
+
Powerball number predictor using quantum-inspired algorithm with momentum, mean reversion, and statistical filters.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install powerball-quantum
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## CLI Usage
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Get 5 recommended picks
|
|
15
|
+
npx powerball-quantum predict
|
|
16
|
+
|
|
17
|
+
# Get 10 picks with analysis
|
|
18
|
+
npx powerball-quantum predict -c 10 -a
|
|
19
|
+
|
|
20
|
+
# Quick single pick
|
|
21
|
+
npx powerball-quantum quick
|
|
22
|
+
|
|
23
|
+
# Update data from NY Lottery API
|
|
24
|
+
npx powerball-quantum update
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Programmatic Usage
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
import { predict, quickPick, formatPick, updateData } from 'powerball-quantum';
|
|
31
|
+
|
|
32
|
+
// Get 5 picks
|
|
33
|
+
const picks = await predict({ count: 5 });
|
|
34
|
+
picks.forEach(pick => {
|
|
35
|
+
console.log(formatPick(pick));
|
|
36
|
+
// Output: 21 - 26 - 34 - 57 - 61 š“ 1
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// Quick single pick
|
|
40
|
+
const myPick = await quickPick();
|
|
41
|
+
console.log(myPick);
|
|
42
|
+
// { whiteBalls: [5, 7, 28, 38, 66], powerball: 23, score: 46.5 }
|
|
43
|
+
|
|
44
|
+
// Update data
|
|
45
|
+
await updateData();
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Algorithm
|
|
49
|
+
|
|
50
|
+
**QUANTUM** combines multiple Wall Street quant-inspired signals:
|
|
51
|
+
|
|
52
|
+
| Signal | Description |
|
|
53
|
+
|--------|-------------|
|
|
54
|
+
| **Momentum** | Exponential decay weighting - recent numbers score higher |
|
|
55
|
+
| **Z-Score** | Mean reversion - overdue numbers get boosted |
|
|
56
|
+
| **Recent Trend** | Last 15 draws with stronger emphasis |
|
|
57
|
+
| **Pair Synergy** | Numbers that frequently appear together |
|
|
58
|
+
|
|
59
|
+
### 7-Stage Filter
|
|
60
|
+
|
|
61
|
+
All picks must pass:
|
|
62
|
+
1. ā No duplicate with historical combinations
|
|
63
|
+
2. ā
Sum range: 130-220
|
|
64
|
+
3. ā
Odd/Even ratio: 2:3 or 3:2
|
|
65
|
+
4. ā
High/Low balance: 2:3 or 3:2
|
|
66
|
+
5. ā
Decade balance: At least 3 different decades
|
|
67
|
+
6. ā
Ending diversity: At least 4 different last digits
|
|
68
|
+
7. ā No triple consecutive numbers
|
|
69
|
+
|
|
70
|
+
## Data Source
|
|
71
|
+
|
|
72
|
+
Historical data from [NY Open Data Powerball API](https://data.ny.gov/Government-Finance/Lottery-Powerball-Winning-Numbers-Beginning-2010/d6yy-54nr).
|
|
73
|
+
|
|
74
|
+
## Disclaimer
|
|
75
|
+
|
|
76
|
+
**For educational and entertainment purposes only.** Lottery numbers are randomly drawn. No algorithm can predict or guarantee winning numbers. Gamble responsibly.
|
|
77
|
+
|
|
78
|
+
## License
|
|
79
|
+
|
|
80
|
+
MIT
|
package/dist/cli.d.ts
ADDED
package/dist/cli.js
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const commander_1 = require("commander");
|
|
5
|
+
const index_1 = require("./index");
|
|
6
|
+
const program = new commander_1.Command();
|
|
7
|
+
program
|
|
8
|
+
.name('powerball-quantum')
|
|
9
|
+
.description('Powerball number predictor using quantum-inspired algorithm')
|
|
10
|
+
.version('1.0.0');
|
|
11
|
+
program
|
|
12
|
+
.command('predict')
|
|
13
|
+
.description('Generate predicted Powerball numbers')
|
|
14
|
+
.option('-c, --count <number>', 'Number of picks to generate', '5')
|
|
15
|
+
.option('-a, --analysis', 'Show signal analysis', false)
|
|
16
|
+
.action(async (options) => {
|
|
17
|
+
console.log('');
|
|
18
|
+
console.log('š± POWERBALL QUANTUM PREDICTOR');
|
|
19
|
+
console.log('ā'.repeat(50));
|
|
20
|
+
try {
|
|
21
|
+
const picks = await (0, index_1.predict)({
|
|
22
|
+
count: parseInt(options.count),
|
|
23
|
+
showAnalysis: options.analysis
|
|
24
|
+
});
|
|
25
|
+
console.log('\nā RECOMMENDED PICKS:\n');
|
|
26
|
+
picks.forEach((pick, i) => {
|
|
27
|
+
const score = pick.score?.toFixed(1) || '?';
|
|
28
|
+
console.log(` #${i + 1} ${(0, index_1.formatPick)(pick)} (score: ${score})`);
|
|
29
|
+
});
|
|
30
|
+
console.log('\n' + 'ā'.repeat(50));
|
|
31
|
+
console.log('Good luck! š\n');
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
console.error('Error:', error);
|
|
35
|
+
process.exit(1);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
program
|
|
39
|
+
.command('update')
|
|
40
|
+
.description('Update Powerball data from NY Lottery API')
|
|
41
|
+
.action(async () => {
|
|
42
|
+
console.log('');
|
|
43
|
+
console.log('š„ Updating Powerball data...');
|
|
44
|
+
console.log('ā'.repeat(50));
|
|
45
|
+
try {
|
|
46
|
+
await (0, index_1.updateData)();
|
|
47
|
+
console.log('ā
Data updated successfully!\n');
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
console.error('Error updating data:', error);
|
|
51
|
+
process.exit(1);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
program
|
|
55
|
+
.command('quick')
|
|
56
|
+
.description('Get one quick pick')
|
|
57
|
+
.action(async () => {
|
|
58
|
+
try {
|
|
59
|
+
const picks = await (0, index_1.predict)({ count: 1 });
|
|
60
|
+
if (picks[0]) {
|
|
61
|
+
console.log('\nš« Your lucky numbers:');
|
|
62
|
+
console.log(`\n ${(0, index_1.formatPick)(picks[0])}\n`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
console.error('Error:', error);
|
|
67
|
+
process.exit(1);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
// Default action (no command)
|
|
71
|
+
if (process.argv.length === 2) {
|
|
72
|
+
program.parse(['node', 'cli', 'predict']);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
program.parse();
|
|
76
|
+
}
|
package/dist/data.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Draw } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Download latest Powerball data from NY Lottery API
|
|
4
|
+
*/
|
|
5
|
+
export declare function downloadData(): Promise<string>;
|
|
6
|
+
/**
|
|
7
|
+
* Parse CSV data into Draw objects
|
|
8
|
+
*/
|
|
9
|
+
export declare function parseCSV(csvContent: string): Draw[];
|
|
10
|
+
/**
|
|
11
|
+
* Load data from file or download if not exists
|
|
12
|
+
*/
|
|
13
|
+
export declare function loadData(): Promise<Draw[]>;
|
|
14
|
+
/**
|
|
15
|
+
* Update data (force re-download)
|
|
16
|
+
*/
|
|
17
|
+
export declare function updateData(): Promise<Draw[]>;
|
package/dist/data.js
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.downloadData = downloadData;
|
|
40
|
+
exports.parseCSV = parseCSV;
|
|
41
|
+
exports.loadData = loadData;
|
|
42
|
+
exports.updateData = updateData;
|
|
43
|
+
const axios_1 = __importDefault(require("axios"));
|
|
44
|
+
const fs = __importStar(require("fs"));
|
|
45
|
+
const path = __importStar(require("path"));
|
|
46
|
+
const types_1 = require("./types");
|
|
47
|
+
const DATA_FILE = path.join(__dirname, '..', 'powerball_data.csv');
|
|
48
|
+
/**
|
|
49
|
+
* Download latest Powerball data from NY Lottery API
|
|
50
|
+
*/
|
|
51
|
+
async function downloadData() {
|
|
52
|
+
console.log('Downloading latest Powerball data...');
|
|
53
|
+
const response = await axios_1.default.get(types_1.DATA_URL);
|
|
54
|
+
fs.writeFileSync(DATA_FILE, response.data);
|
|
55
|
+
console.log('Download complete!');
|
|
56
|
+
return DATA_FILE;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Parse CSV data into Draw objects
|
|
60
|
+
*/
|
|
61
|
+
function parseCSV(csvContent) {
|
|
62
|
+
const lines = csvContent.trim().split('\n');
|
|
63
|
+
const draws = [];
|
|
64
|
+
// Skip header
|
|
65
|
+
for (let i = 1; i < lines.length; i++) {
|
|
66
|
+
const line = lines[i].trim();
|
|
67
|
+
if (!line)
|
|
68
|
+
continue;
|
|
69
|
+
const parts = line.split(',');
|
|
70
|
+
if (parts.length < 3)
|
|
71
|
+
continue;
|
|
72
|
+
const dateStr = parts[0];
|
|
73
|
+
const numbersStr = parts[1];
|
|
74
|
+
const multiplier = parseInt(parts[2]) || 2;
|
|
75
|
+
const numbers = numbersStr.split(' ').map(n => parseInt(n.trim()));
|
|
76
|
+
if (numbers.length < 6)
|
|
77
|
+
continue;
|
|
78
|
+
const date = new Date(dateStr);
|
|
79
|
+
// Filter for current rules (post Oct 7, 2015)
|
|
80
|
+
if (date < new Date('2015-10-07'))
|
|
81
|
+
continue;
|
|
82
|
+
draws.push({
|
|
83
|
+
date,
|
|
84
|
+
whiteBalls: numbers.slice(0, 5),
|
|
85
|
+
powerball: numbers[5],
|
|
86
|
+
multiplier
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
return draws;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Load data from file or download if not exists
|
|
93
|
+
*/
|
|
94
|
+
async function loadData() {
|
|
95
|
+
let csvContent;
|
|
96
|
+
if (fs.existsSync(DATA_FILE)) {
|
|
97
|
+
csvContent = fs.readFileSync(DATA_FILE, 'utf-8');
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
await downloadData();
|
|
101
|
+
csvContent = fs.readFileSync(DATA_FILE, 'utf-8');
|
|
102
|
+
}
|
|
103
|
+
const draws = parseCSV(csvContent);
|
|
104
|
+
console.log(`Loaded ${draws.length} draws (current rules since 2015-10-07)`);
|
|
105
|
+
return draws;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Update data (force re-download)
|
|
109
|
+
*/
|
|
110
|
+
async function updateData() {
|
|
111
|
+
await downloadData();
|
|
112
|
+
const csvContent = fs.readFileSync(DATA_FILE, 'utf-8');
|
|
113
|
+
const draws = parseCSV(csvContent);
|
|
114
|
+
console.log(`Updated! ${draws.length} draws loaded.`);
|
|
115
|
+
return draws;
|
|
116
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Draw, Pick, PredictOptions } from './types';
|
|
2
|
+
import { loadData, updateData } from './data';
|
|
3
|
+
export { Draw, Pick, PredictOptions } from './types';
|
|
4
|
+
export { loadData, updateData } from './data';
|
|
5
|
+
/**
|
|
6
|
+
* Generate a single quantum-powered pick
|
|
7
|
+
*/
|
|
8
|
+
export declare function generatePick(draws: Draw[], historySet: Set<string>, whiteMomentum: Record<number, number>, redMomentum: Record<number, number>, whiteZ: Record<number, number>, redZ: Record<number, number>, whiteRecent: Record<number, number>, redRecent: Record<number, number>, pairBonus: Record<number, number>): Pick | null;
|
|
9
|
+
/**
|
|
10
|
+
* Main prediction function - call this to get picks!
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* import { predict } from 'powerball-quantum';
|
|
15
|
+
*
|
|
16
|
+
* const picks = await predict({ count: 5 });
|
|
17
|
+
* console.log(picks);
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare function predict(options?: PredictOptions): Promise<Pick[]>;
|
|
21
|
+
/**
|
|
22
|
+
* Quick function to get a single best pick
|
|
23
|
+
*/
|
|
24
|
+
export declare function quickPick(): Promise<Pick | null>;
|
|
25
|
+
/**
|
|
26
|
+
* Format pick for display
|
|
27
|
+
*/
|
|
28
|
+
export declare function formatPick(pick: Pick): string;
|
|
29
|
+
declare const _default: {
|
|
30
|
+
predict: typeof predict;
|
|
31
|
+
quickPick: typeof quickPick;
|
|
32
|
+
updateData: typeof updateData;
|
|
33
|
+
loadData: typeof loadData;
|
|
34
|
+
formatPick: typeof formatPick;
|
|
35
|
+
};
|
|
36
|
+
export default _default;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateData = exports.loadData = void 0;
|
|
4
|
+
exports.generatePick = generatePick;
|
|
5
|
+
exports.predict = predict;
|
|
6
|
+
exports.quickPick = quickPick;
|
|
7
|
+
exports.formatPick = formatPick;
|
|
8
|
+
const data_1 = require("./data");
|
|
9
|
+
const quantum_1 = require("./quantum");
|
|
10
|
+
var data_2 = require("./data");
|
|
11
|
+
Object.defineProperty(exports, "loadData", { enumerable: true, get: function () { return data_2.loadData; } });
|
|
12
|
+
Object.defineProperty(exports, "updateData", { enumerable: true, get: function () { return data_2.updateData; } });
|
|
13
|
+
/**
|
|
14
|
+
* Generate a single quantum-powered pick
|
|
15
|
+
*/
|
|
16
|
+
function generatePick(draws, historySet, whiteMomentum, redMomentum, whiteZ, redZ, whiteRecent, redRecent, pairBonus) {
|
|
17
|
+
const maxAttempts = 150000;
|
|
18
|
+
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
19
|
+
const whiteBalls = (0, quantum_1.quantumSelect)(whiteMomentum, whiteZ, whiteRecent, pairBonus, 5).sort((a, b) => a - b);
|
|
20
|
+
const powerball = (0, quantum_1.quantumSelect)(redMomentum, redZ, redRecent, {}, 1)[0];
|
|
21
|
+
// Apply all filters
|
|
22
|
+
if ((0, quantum_1.isInHistory)(whiteBalls, powerball, historySet))
|
|
23
|
+
continue;
|
|
24
|
+
if (!(0, quantum_1.checkSumRange)(whiteBalls))
|
|
25
|
+
continue;
|
|
26
|
+
if (!(0, quantum_1.checkOddEvenRatio)(whiteBalls))
|
|
27
|
+
continue;
|
|
28
|
+
if (!(0, quantum_1.checkHighLowBalance)(whiteBalls))
|
|
29
|
+
continue;
|
|
30
|
+
if (!(0, quantum_1.checkDecadeBalance)(whiteBalls))
|
|
31
|
+
continue;
|
|
32
|
+
if (!(0, quantum_1.checkEndingDiversity)(whiteBalls))
|
|
33
|
+
continue;
|
|
34
|
+
if (!(0, quantum_1.checkNoTripleConsecutive)(whiteBalls))
|
|
35
|
+
continue;
|
|
36
|
+
// Calculate score
|
|
37
|
+
let score = 0;
|
|
38
|
+
whiteBalls.forEach(n => {
|
|
39
|
+
score += (whiteMomentum[n] || 0) * 1.0;
|
|
40
|
+
score += Math.max(0, whiteZ[n] || 0) * 3.0;
|
|
41
|
+
score += (whiteRecent[n] || 0) * 2.0;
|
|
42
|
+
score += (pairBonus[n] || 0) * 0.5;
|
|
43
|
+
});
|
|
44
|
+
score += (redMomentum[powerball] || 0) * 2.0;
|
|
45
|
+
score += Math.max(0, redZ[powerball] || 0) * 4.0;
|
|
46
|
+
return { whiteBalls, powerball, score };
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Main prediction function - call this to get picks!
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* import { predict } from 'powerball-quantum';
|
|
56
|
+
*
|
|
57
|
+
* const picks = await predict({ count: 5 });
|
|
58
|
+
* console.log(picks);
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
async function predict(options = {}) {
|
|
62
|
+
const { count = 5, showAnalysis = false } = options;
|
|
63
|
+
// Load data
|
|
64
|
+
const draws = await (0, data_1.loadData)();
|
|
65
|
+
const historySet = (0, quantum_1.buildHistorySet)(draws);
|
|
66
|
+
// Calculate all signals
|
|
67
|
+
const { white: wMom, red: rMom } = (0, quantum_1.calculateMomentum)(draws);
|
|
68
|
+
const { white: wZ, red: rZ } = (0, quantum_1.calculateZScores)(draws);
|
|
69
|
+
const { white: wRecent, red: rRecent } = (0, quantum_1.calculateRecentMomentum)(draws, 15);
|
|
70
|
+
const pairBonus = (0, quantum_1.analyzePairFrequency)(draws, 50);
|
|
71
|
+
if (showAnalysis) {
|
|
72
|
+
console.log('\nš Signal Analysis:');
|
|
73
|
+
const topMom = Object.entries(wMom).sort((a, b) => b[1] - a[1]).slice(0, 10);
|
|
74
|
+
console.log('š„ Hot Numbers:', topMom.map(([n]) => n));
|
|
75
|
+
const topZ = Object.entries(wZ).sort((a, b) => b[1] - a[1]).slice(0, 10);
|
|
76
|
+
console.log('ā° Overdue Numbers:', topZ.filter(([, z]) => z > 1).map(([n]) => n));
|
|
77
|
+
}
|
|
78
|
+
// Generate picks
|
|
79
|
+
const picks = [];
|
|
80
|
+
const seen = new Set();
|
|
81
|
+
for (let i = 0; i < count * 10 && picks.length < count; i++) {
|
|
82
|
+
const pick = generatePick(draws, historySet, wMom, rMom, wZ, rZ, wRecent, rRecent, pairBonus);
|
|
83
|
+
if (pick) {
|
|
84
|
+
const key = pick.whiteBalls.join(',') + '-' + pick.powerball;
|
|
85
|
+
if (!seen.has(key)) {
|
|
86
|
+
seen.add(key);
|
|
87
|
+
picks.push(pick);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
// Sort by score
|
|
92
|
+
picks.sort((a, b) => (b.score || 0) - (a.score || 0));
|
|
93
|
+
return picks;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Quick function to get a single best pick
|
|
97
|
+
*/
|
|
98
|
+
async function quickPick() {
|
|
99
|
+
const picks = await predict({ count: 1 });
|
|
100
|
+
return picks[0] || null;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Format pick for display
|
|
104
|
+
*/
|
|
105
|
+
function formatPick(pick) {
|
|
106
|
+
const whites = pick.whiteBalls.map(n => n.toString().padStart(2, ' ')).join(' - ');
|
|
107
|
+
return `${whites} š“ ${pick.powerball}`;
|
|
108
|
+
}
|
|
109
|
+
// Default export
|
|
110
|
+
exports.default = { predict, quickPick, updateData: data_1.updateData, loadData: data_1.loadData, formatPick };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Draw, Scores } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Calculate exponential decay momentum scores
|
|
4
|
+
*/
|
|
5
|
+
export declare function calculateMomentum(draws: Draw[], decayAlpha?: number): {
|
|
6
|
+
white: Scores;
|
|
7
|
+
red: Scores;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Calculate Z-scores for gap analysis (mean reversion)
|
|
11
|
+
*/
|
|
12
|
+
export declare function calculateZScores(draws: Draw[]): {
|
|
13
|
+
white: Scores;
|
|
14
|
+
red: Scores;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Calculate recent momentum (last N draws)
|
|
18
|
+
*/
|
|
19
|
+
export declare function calculateRecentMomentum(draws: Draw[], nRecent?: number, decay?: number): {
|
|
20
|
+
white: Scores;
|
|
21
|
+
red: Scores;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Analyze pair frequency
|
|
25
|
+
*/
|
|
26
|
+
export declare function analyzePairFrequency(draws: Draw[], topN?: number): Scores;
|
|
27
|
+
/**
|
|
28
|
+
* Weighted random selection
|
|
29
|
+
*/
|
|
30
|
+
export declare function weightedSample(candidates: number[], weights: number[], k: number): number[];
|
|
31
|
+
/**
|
|
32
|
+
* Quantum selector combining all signals
|
|
33
|
+
*/
|
|
34
|
+
export declare function quantumSelect(momentum: Scores, zScores: Scores, recentMomentum: Scores, pairBonus: Scores, nPicks: number): number[];
|
|
35
|
+
export declare function checkSumRange(whiteBalls: number[], min?: number, max?: number): boolean;
|
|
36
|
+
export declare function checkOddEvenRatio(whiteBalls: number[]): boolean;
|
|
37
|
+
export declare function checkHighLowBalance(whiteBalls: number[], threshold?: number): boolean;
|
|
38
|
+
export declare function checkDecadeBalance(whiteBalls: number[]): boolean;
|
|
39
|
+
export declare function checkEndingDiversity(whiteBalls: number[]): boolean;
|
|
40
|
+
export declare function checkNoTripleConsecutive(whiteBalls: number[]): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Check if combination exists in history
|
|
43
|
+
*/
|
|
44
|
+
export declare function isInHistory(whiteBalls: number[], powerball: number, history: Set<string>): boolean;
|
|
45
|
+
export declare function buildHistorySet(draws: Draw[]): Set<string>;
|