git-slot-machine 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/LICENSE +21 -0
- package/README.md +313 -0
- package/dist/animation/slotMachine.d.ts +9 -0
- package/dist/animation/slotMachine.d.ts.map +1 -0
- package/dist/animation/slotMachine.js +139 -0
- package/dist/animation/slotMachine.js.map +1 -0
- package/dist/api.d.ts +40 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +154 -0
- package/dist/api.js.map +1 -0
- package/dist/balance.d.ts +11 -0
- package/dist/balance.d.ts.map +1 -0
- package/dist/balance.js +131 -0
- package/dist/balance.js.map +1 -0
- package/dist/commands/auth.d.ts +4 -0
- package/dist/commands/auth.d.ts.map +1 -0
- package/dist/commands/auth.js +91 -0
- package/dist/commands/auth.js.map +1 -0
- package/dist/commands/balance.d.ts +2 -0
- package/dist/commands/balance.d.ts.map +1 -0
- package/dist/commands/balance.js +32 -0
- package/dist/commands/balance.js.map +1 -0
- package/dist/commands/config.d.ts +3 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +60 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +148 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/play.d.ts +7 -0
- package/dist/commands/play.d.ts.map +1 -0
- package/dist/commands/play.js +137 -0
- package/dist/commands/play.js.map +1 -0
- package/dist/commands/spin.d.ts +6 -0
- package/dist/commands/spin.d.ts.map +1 -0
- package/dist/commands/spin.js +17 -0
- package/dist/commands/spin.js.map +1 -0
- package/dist/commands/sync.d.ts +2 -0
- package/dist/commands/sync.d.ts.map +1 -0
- package/dist/commands/sync.js +52 -0
- package/dist/commands/sync.js.map +1 -0
- package/dist/commands/test.d.ts +6 -0
- package/dist/commands/test.d.ts.map +1 -0
- package/dist/commands/test.js +17 -0
- package/dist/commands/test.js.map +1 -0
- package/dist/config.d.ts +27 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +144 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +100 -0
- package/dist/index.js.map +1 -0
- package/dist/patterns.d.ts +27 -0
- package/dist/patterns.d.ts.map +1 -0
- package/dist/patterns.js +266 -0
- package/dist/patterns.js.map +1 -0
- package/dist/templates/post-commit.d.ts +2 -0
- package/dist/templates/post-commit.d.ts.map +1 -0
- package/dist/templates/post-commit.js +19 -0
- package/dist/templates/post-commit.js.map +1 -0
- package/dist/utils/git.d.ts +4 -0
- package/dist/utils/git.d.ts.map +1 -0
- package/dist/utils/git.js +42 -0
- package/dist/utils/git.js.map +1 -0
- package/jest.config.js +12 -0
- package/package.json +50 -0
- package/src/animation/slotMachine.ts +159 -0
- package/src/api.ts +203 -0
- package/src/balance.ts +118 -0
- package/src/commands/auth.ts +92 -0
- package/src/commands/balance.ts +28 -0
- package/src/commands/config.ts +59 -0
- package/src/commands/init.ts +121 -0
- package/src/commands/play.ts +150 -0
- package/src/commands/spin.ts +17 -0
- package/src/commands/sync.ts +49 -0
- package/src/commands/test.ts +19 -0
- package/src/config.ts +154 -0
- package/src/index.ts +114 -0
- package/src/patterns.test.ts +44 -0
- package/src/patterns.ts +292 -0
- package/src/templates/post-commit.ts +15 -0
- package/src/utils/git.ts +38 -0
- package/test.txt +2 -0
- package/tsconfig.json +20 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Than Tibbetts
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
# 🎰 Git Slot Machine
|
|
2
|
+
|
|
3
|
+
**Turn every git commit into a slot machine pull!**
|
|
4
|
+
|
|
5
|
+
A fun CLI tool that analyzes your commit hashes and rewards you based on patterns found in the first 7 hex characters. Automatically plays after each commit via a post-commit hook, syncs with a global leaderboard, and tracks your stats across all your repos.
|
|
6
|
+
|
|
7
|
+
🎰 **Live Leaderboard:** [gitslotmachine.com](https://gitslotmachine.com)
|
|
8
|
+
🔧 **Backend API:** [GitHub](https://github.com/than/gitslotmachine.com)
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Quick Start
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
# Install globally
|
|
16
|
+
npm install -g git-slot-machine
|
|
17
|
+
|
|
18
|
+
# Authenticate with your GitHub username
|
|
19
|
+
git-slot-machine auth login
|
|
20
|
+
|
|
21
|
+
# Install post-commit hook in your repo
|
|
22
|
+
cd your-repo
|
|
23
|
+
git-slot-machine init
|
|
24
|
+
|
|
25
|
+
# Make a commit and watch the magic happen!
|
|
26
|
+
git commit -m "feat: add new feature"
|
|
27
|
+
# 🎰 aa1bb2c • TWO PAIR +50 • Balance: 150
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Features
|
|
33
|
+
|
|
34
|
+
✅ **Automatic gameplay** - Plays after every commit via post-commit hook
|
|
35
|
+
✅ **Global sync** - Balance and stats sync across all your repos
|
|
36
|
+
✅ **Leaderboards** - Daily and all-time rankings at gitslotmachine.com
|
|
37
|
+
✅ **Win streaks** - Track consecutive wins with detailed history
|
|
38
|
+
✅ **Shareable wins** - Get a unique URL for your big wins
|
|
39
|
+
✅ **Offline mode** - Works without internet, syncs when available
|
|
40
|
+
✅ **Multiple modes** - Animated slot machine or compact single-line output
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Installation
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npm install -g git-slot-machine
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Commands
|
|
53
|
+
|
|
54
|
+
### Authentication
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
# Login with your GitHub username
|
|
58
|
+
git-slot-machine auth login
|
|
59
|
+
|
|
60
|
+
# Check authentication status
|
|
61
|
+
git-slot-machine auth status
|
|
62
|
+
|
|
63
|
+
# Logout
|
|
64
|
+
git-slot-machine auth logout
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Gameplay
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# Play with a specific 7-character hash
|
|
71
|
+
git-slot-machine play <hash>
|
|
72
|
+
|
|
73
|
+
# Play with current commit
|
|
74
|
+
git-slot-machine spin
|
|
75
|
+
|
|
76
|
+
# Play with current commit (compact mode)
|
|
77
|
+
git-slot-machine spin --small
|
|
78
|
+
|
|
79
|
+
# Test with a random hash
|
|
80
|
+
git-slot-machine test
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Setup
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
# Install post-commit hook in current repo
|
|
87
|
+
git-slot-machine init
|
|
88
|
+
|
|
89
|
+
# Check your balance and stats
|
|
90
|
+
git-slot-machine balance
|
|
91
|
+
|
|
92
|
+
# Sync local balance with server
|
|
93
|
+
git-slot-machine sync
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Configuration
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
# View current configuration
|
|
100
|
+
git-slot-machine config list
|
|
101
|
+
|
|
102
|
+
# Set API URL (default: Laravel Cloud)
|
|
103
|
+
git-slot-machine config set api-url https://api.gitslotmachine.com/api
|
|
104
|
+
|
|
105
|
+
# Enable/disable automatic syncing
|
|
106
|
+
git-slot-machine config set sync-enabled true
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Winning Patterns & Payouts
|
|
112
|
+
|
|
113
|
+
Every commit costs **10 points**. You start with **100 points**.
|
|
114
|
+
|
|
115
|
+
| Pattern | Example | Payout | Probability | Expected Value | ROI per Win | Description |
|
|
116
|
+
|---------|---------|--------|-------------|----------------|-------------|-------------|
|
|
117
|
+
| **JACKPOT** | `aaaaaaa` | +10,000 | 1 in 16,777,216 | +0.0006 | +99,900% | All same character |
|
|
118
|
+
| **HEXTET** | `aaaaaa1` | +5,000 | 1 in 159,784 | +0.031 | +49,900% | Six of a kind |
|
|
119
|
+
| **LUCKY SEVEN** | `1234567` | +2,500 | 1 in ~2,500,000 | ~+0.001 | +24,900% | Seven in a row |
|
|
120
|
+
| **FULLEST HOUSE** | `aaaabbb` | +2,000 | 1 in 31,956 | +0.063 | +19,900% | 4 + 3 of a kind |
|
|
121
|
+
| **FIVE OF A KIND** | `aaaaa12` | +1,000 | 1 in 7,989 | +0.125 | +9,900% | Five of a kind |
|
|
122
|
+
| **BIG STRAIGHT** | `012345a` | +500 | 1 in ~280,000 | ~+0.002 | +4,900% | Six in a row |
|
|
123
|
+
| **FOUR OF A KIND** | `aaaa123` | +400 | 1 in 799 | +0.501 | +3,900% | Four of a kind |
|
|
124
|
+
| **ALL LETTERS** | `abcdefa` | +300 | 1 in 959 | +0.313 | +2,900% | Only letters (a-f) |
|
|
125
|
+
| **STRAIGHT** | `01234ab` | +200 | 1 in ~9,000 | ~+0.022 | +1,900% | Five in a row |
|
|
126
|
+
| **DOUBLE TRIPLE** | `aaabbb1` | +150 | 1 in ~2,000 | ~+0.075 | +1,400% | Two three of a kinds |
|
|
127
|
+
| **FULL HOUSE** | `aaaabb1` | +100 | 1 in ~1,000 | ~+0.100 | +900% | Three and two of a kind |
|
|
128
|
+
| **THREE PAIR** | `aabbcc1` | +150 | 1 in ~1,600 | ~+0.094 | +1,400% | Three consecutive pairs |
|
|
129
|
+
| **THREE OF A KIND** | `aaa1234` | +50 | 1 in 15 | +3.333 | +400% | Three of a kind |
|
|
130
|
+
| **TWO PAIR** | `aabb1cd` | +50 | 1 in 45 | +1.111 | +400% | Two consecutive pairs |
|
|
131
|
+
| **ALL NUMBERS** | `1230984` | +10 | 1 in 26.8 | +0.373 | 0% | Only numbers (break even) |
|
|
132
|
+
| **NO WIN** | `abcd123` | -10 | ~35% | ~-3.5 | -200% | No pattern |
|
|
133
|
+
|
|
134
|
+
## Statistics & Probabilities
|
|
135
|
+
|
|
136
|
+
For the nerds who love the math:
|
|
137
|
+
|
|
138
|
+
### Win Rate Analysis
|
|
139
|
+
|
|
140
|
+
| Category | Percentage | Expected Value |
|
|
141
|
+
|----------|------------|----------------|
|
|
142
|
+
| **Total Win Rate** | ~65% | Positive EV |
|
|
143
|
+
| **No Win Rate** | ~35% | -10 points |
|
|
144
|
+
| **Profit Rate** | ~61% | Positive return |
|
|
145
|
+
| **Break Even Rate** | ~3.7% | 0 net (all numbers) |
|
|
146
|
+
|
|
147
|
+
### Pattern Rarity Tiers
|
|
148
|
+
|
|
149
|
+
**Legendary (Once in a lifetime):**
|
|
150
|
+
- JACKPOT, HEXTET, LUCKY SEVEN
|
|
151
|
+
|
|
152
|
+
**Epic (Very rare):**
|
|
153
|
+
- FULLEST HOUSE, FIVE OF A KIND, BIG STRAIGHT
|
|
154
|
+
|
|
155
|
+
**Rare (Uncommon):**
|
|
156
|
+
- FOUR OF A KIND, ALL LETTERS, STRAIGHT
|
|
157
|
+
|
|
158
|
+
**Uncommon (Regular wins):**
|
|
159
|
+
- DOUBLE TRIPLE, FULL HOUSE, THREE PAIR
|
|
160
|
+
|
|
161
|
+
**Common (Frequent wins):**
|
|
162
|
+
- THREE OF A KIND, TWO PAIR, ALL NUMBERS
|
|
163
|
+
|
|
164
|
+
### Expected Gameplay
|
|
165
|
+
|
|
166
|
+
**If you make 100 commits, you can expect:**
|
|
167
|
+
- ~35 no wins (-350 points)
|
|
168
|
+
- ~3 two pairs (+150 points)
|
|
169
|
+
- ~4 all numbers (+40 points)
|
|
170
|
+
- ~1 three of a kind (+50 points)
|
|
171
|
+
- Various rarer patterns adding up to roughly break even or slight positive
|
|
172
|
+
|
|
173
|
+
**Net result:** Slight positive expectation with high variance!
|
|
174
|
+
|
|
175
|
+
### Longest Expected Droughts
|
|
176
|
+
|
|
177
|
+
- **JACKPOT**: You'd need to commit ~46,000 times per day for 1,000 years to statistically see one
|
|
178
|
+
- **HEXTET**: ~440 commits per day for 1 year
|
|
179
|
+
- **LUCKY SEVEN**: ~6,850 commits per day for 1 year
|
|
180
|
+
- **FULLEST HOUSE**: ~88 commits per day for 1 year
|
|
181
|
+
|
|
182
|
+
### Fastest to Hit (statistically)
|
|
183
|
+
|
|
184
|
+
- **THREE OF A KIND**: Most common win, about 1 in 15 commits
|
|
185
|
+
- **ALL NUMBERS**: Break even, about 1 in 27 commits
|
|
186
|
+
- **TWO PAIR**: Should see one in your first 45 commits
|
|
187
|
+
|
|
188
|
+
### Commit Milestones
|
|
189
|
+
|
|
190
|
+
- **10 commits**: Likely seen some all numbers, maybe a two pair
|
|
191
|
+
- **100 commits**: Should have hit at least one two pair and three of a kind
|
|
192
|
+
- **1,000 commits**: Decent chance of seeing a four of a kind or straight
|
|
193
|
+
- **10,000 commits**: Good shot at a fullest house or five of a kind
|
|
194
|
+
- **100,000 commits**: Might see a hextet if you're lucky
|
|
195
|
+
- **1,000,000 commits**: JACKPOT is still astronomically unlikely
|
|
196
|
+
|
|
197
|
+
### House Edge
|
|
198
|
+
|
|
199
|
+
- **Cost per play:** 10 points
|
|
200
|
+
- **Expected return:** ~10+ points
|
|
201
|
+
- **House edge:** Slight player advantage (balanced for fun!)
|
|
202
|
+
- **Standard deviation:** High variance (big wins are rare but huge)
|
|
203
|
+
|
|
204
|
+
## Pattern Detection Details
|
|
205
|
+
|
|
206
|
+
### Consecutive Pairs
|
|
207
|
+
TWO PAIR and THREE PAIR require consecutive identical characters:
|
|
208
|
+
- `aabb1cd` = TWO PAIR ✓ (pairs are `aa` and `bb`)
|
|
209
|
+
- `a1b2abc` = NO WIN ✗ (a's and b's are separated)
|
|
210
|
+
|
|
211
|
+
### Straights
|
|
212
|
+
Must be sequential hex values (can be ascending or descending):
|
|
213
|
+
- `0123456` = LUCKY SEVEN ✓
|
|
214
|
+
- `fedcba9` = LUCKY SEVEN ✓
|
|
215
|
+
- `012abc3` = NO WIN ✗
|
|
216
|
+
|
|
217
|
+
### Frequency Patterns
|
|
218
|
+
Based on character counts:
|
|
219
|
+
- Three of a kind beats scattered pairs
|
|
220
|
+
- Full house beats three of a kind
|
|
221
|
+
- Pattern priority is checked from rarest to most common
|
|
222
|
+
|
|
223
|
+
*Note: Actual probabilities are approximate. Pattern detection checks in order of rarity, so higher-value patterns take precedence.*
|
|
224
|
+
|
|
225
|
+
## How It Works
|
|
226
|
+
|
|
227
|
+
1. **Install the hook**: `git-slot-machine init` adds a post-commit hook to your repo
|
|
228
|
+
2. **Make commits**: Every time you commit, the hook runs automatically
|
|
229
|
+
3. **Get results**: See your pattern, payout, and updated balance immediately
|
|
230
|
+
4. **Sync globally**: Your plays sync to gitslotmachine.com (if authenticated)
|
|
231
|
+
5. **Compete**: Climb the leaderboards and build win streaks!
|
|
232
|
+
|
|
233
|
+
### Privacy & Data
|
|
234
|
+
|
|
235
|
+
The CLI sends the following data to the server when authenticated:
|
|
236
|
+
- Commit hash (first 7 chars + full hash)
|
|
237
|
+
- Repository information (URL, owner, name)
|
|
238
|
+
- GitHub username
|
|
239
|
+
- Pattern detected and payout
|
|
240
|
+
|
|
241
|
+
Your balance is tracked both locally and on the server. You can disable syncing anytime:
|
|
242
|
+
```bash
|
|
243
|
+
git-slot-machine config set sync-enabled false
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## Development
|
|
249
|
+
|
|
250
|
+
### Setup
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
# Clone the repo
|
|
254
|
+
git clone https://github.com/than/git-slot-machine.git
|
|
255
|
+
cd git-slot-machine
|
|
256
|
+
|
|
257
|
+
# Install dependencies
|
|
258
|
+
npm install
|
|
259
|
+
|
|
260
|
+
# Build TypeScript
|
|
261
|
+
npm run build
|
|
262
|
+
|
|
263
|
+
# Link for local testing
|
|
264
|
+
npm link
|
|
265
|
+
|
|
266
|
+
# Run tests (if available)
|
|
267
|
+
npm test
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
### Project Structure
|
|
271
|
+
|
|
272
|
+
```
|
|
273
|
+
src/
|
|
274
|
+
├── api.ts # API client with fallback domains
|
|
275
|
+
├── balance.ts # Local balance management
|
|
276
|
+
├── commands/ # CLI command implementations
|
|
277
|
+
│ ├── auth.ts # Authentication commands
|
|
278
|
+
│ ├── config.ts # Configuration commands
|
|
279
|
+
│ ├── init.ts # Post-commit hook setup
|
|
280
|
+
│ ├── play.ts # Play with specific hash
|
|
281
|
+
│ ├── spin.ts # Play with current commit
|
|
282
|
+
│ └── sync.ts # Balance sync
|
|
283
|
+
├── config.ts # Configuration file management
|
|
284
|
+
├── index.ts # CLI entry point
|
|
285
|
+
├── patterns.ts # Pattern detection logic
|
|
286
|
+
└── utils/
|
|
287
|
+
└── git.ts # Git operations
|
|
288
|
+
|
|
289
|
+
dist/ # Compiled JavaScript
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
---
|
|
293
|
+
|
|
294
|
+
## Contributing
|
|
295
|
+
|
|
296
|
+
Contributions welcome! Please feel free to:
|
|
297
|
+
- Open issues for bugs or feature requests
|
|
298
|
+
- Submit pull requests
|
|
299
|
+
- Share your biggest wins!
|
|
300
|
+
|
|
301
|
+
---
|
|
302
|
+
|
|
303
|
+
## License
|
|
304
|
+
|
|
305
|
+
MIT License - see [LICENSE](LICENSE) file for details
|
|
306
|
+
|
|
307
|
+
---
|
|
308
|
+
|
|
309
|
+
## Credits
|
|
310
|
+
|
|
311
|
+
Built by [Than Tibbetts](https://github.com/than)
|
|
312
|
+
|
|
313
|
+
Powered by Node.js, TypeScript, and chalk
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PatternResult } from '../patterns';
|
|
2
|
+
export interface SlotConfig {
|
|
3
|
+
finalHash: string;
|
|
4
|
+
small: boolean;
|
|
5
|
+
patternResult?: PatternResult;
|
|
6
|
+
}
|
|
7
|
+
export declare function animateSlotMachine(config: SlotConfig): Promise<void>;
|
|
8
|
+
export declare function animateSmallMode(config: SlotConfig): Promise<void>;
|
|
9
|
+
//# sourceMappingURL=slotMachine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slotMachine.d.ts","sourceRoot":"","sources":["../../src/animation/slotMachine.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAO5C,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,OAAO,CAAC;IACf,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B;AAgED,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAuD1E;AAED,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAyBxE"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.animateSlotMachine = animateSlotMachine;
|
|
7
|
+
exports.animateSmallMode = animateSmallMode;
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const HEX_CHARS = '0123456789abcdef'.split('');
|
|
10
|
+
const ANIMATION_SPEED = 50; // ms per frame
|
|
11
|
+
const SPIN_DURATION = 2000; // total animation time
|
|
12
|
+
const FRAMES = SPIN_DURATION / ANIMATION_SPEED;
|
|
13
|
+
function getRandomHexChar() {
|
|
14
|
+
return HEX_CHARS[Math.floor(Math.random() * HEX_CHARS.length)];
|
|
15
|
+
}
|
|
16
|
+
function clearLine() {
|
|
17
|
+
process.stdout.write('\r\x1b[K');
|
|
18
|
+
}
|
|
19
|
+
function drawSlotMachine(chars, spinning, highlightIndices = [], flash = false) {
|
|
20
|
+
// Casino color palette: red borders, white title
|
|
21
|
+
const borderColor = chalk_1.default.rgb(220, 20, 60); // Crimson red
|
|
22
|
+
const titleColor = chalk_1.default.white; // White
|
|
23
|
+
const borderWidth = 39;
|
|
24
|
+
const border = '═'.repeat(borderWidth);
|
|
25
|
+
const topBorder = borderColor('╔' + border + '╗');
|
|
26
|
+
const middleBorder = borderColor('╠' + border + '╣');
|
|
27
|
+
const bottomBorder = borderColor('╚' + border + '╝');
|
|
28
|
+
// Title line - emojis count as 2 visual chars each
|
|
29
|
+
const titleText = 'GIT SLOT MACHINE';
|
|
30
|
+
const titleVisualWidth = 2 + 2 + titleText.length + 2 + 2; // emoji + spaces + text + spaces + emoji
|
|
31
|
+
const titlePadding = Math.floor((borderWidth - titleVisualWidth) / 2);
|
|
32
|
+
const titleRightPad = borderWidth - titleVisualWidth - titlePadding;
|
|
33
|
+
const titleLine = borderColor('║') + ' '.repeat(titlePadding) + chalk_1.default.rgb(255, 255, 255)('🎰 ' + titleText + ' 🎰') + ' '.repeat(titleRightPad) + borderColor('║');
|
|
34
|
+
console.log(topBorder);
|
|
35
|
+
console.log(titleLine);
|
|
36
|
+
console.log(middleBorder);
|
|
37
|
+
// Display the 7 characters as slot reels
|
|
38
|
+
const display = chars.map((char, i) => {
|
|
39
|
+
if (spinning) {
|
|
40
|
+
// Spinning - white blur
|
|
41
|
+
return chalk_1.default.rgb(255, 255, 255).bold(char);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
// Check if this character should be highlighted
|
|
45
|
+
const isHighlighted = highlightIndices.includes(i);
|
|
46
|
+
if (isHighlighted && flash) {
|
|
47
|
+
// Flash state - yellow inverse (yellow background, black text)
|
|
48
|
+
return chalk_1.default.bgRgb(255, 255, 0).rgb(0, 0, 0).bold(char);
|
|
49
|
+
}
|
|
50
|
+
else if (isHighlighted) {
|
|
51
|
+
// Normal highlighted state - yellow inverse (yellow background, black text)
|
|
52
|
+
return chalk_1.default.bgRgb(255, 255, 0).rgb(0, 0, 0).bold(char);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
// Not highlighted - white text
|
|
56
|
+
return chalk_1.default.rgb(255, 255, 255)(char);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}).join(' ');
|
|
60
|
+
// Calculate padding for character display (7 chars + 6 double-space separators = 19 visual chars)
|
|
61
|
+
const displayVisualWidth = 7 + 12; // 7 chars + 6*2 spaces
|
|
62
|
+
const displayPadding = Math.floor((borderWidth - displayVisualWidth) / 2);
|
|
63
|
+
const displayRightPad = borderWidth - displayVisualWidth - displayPadding;
|
|
64
|
+
const displayLine = borderColor('║') + ' '.repeat(displayPadding) + display + ' '.repeat(displayRightPad) + borderColor('║');
|
|
65
|
+
console.log(displayLine);
|
|
66
|
+
console.log(bottomBorder);
|
|
67
|
+
}
|
|
68
|
+
async function animateSlotMachine(config) {
|
|
69
|
+
const { finalHash, patternResult } = config;
|
|
70
|
+
const highlightIndices = patternResult?.highlightIndices || [];
|
|
71
|
+
// Clear screen
|
|
72
|
+
console.clear();
|
|
73
|
+
// Initialize with random characters
|
|
74
|
+
let currentChars = Array(7).fill(0).map(() => getRandomHexChar());
|
|
75
|
+
// Animate spinning
|
|
76
|
+
for (let frame = 0; frame < FRAMES; frame++) {
|
|
77
|
+
// Gradually slow down and settle on final hash
|
|
78
|
+
const progress = frame / FRAMES;
|
|
79
|
+
if (progress < 0.9) {
|
|
80
|
+
// Still spinning - show random
|
|
81
|
+
currentChars = currentChars.map(() => getRandomHexChar());
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
// Start settling - reveal characters one by one
|
|
85
|
+
const revealIndex = Math.floor((progress - 0.9) / 0.1 * 7);
|
|
86
|
+
for (let i = 0; i < revealIndex; i++) {
|
|
87
|
+
currentChars[i] = finalHash[i];
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
// Redraw
|
|
91
|
+
console.clear();
|
|
92
|
+
drawSlotMachine(currentChars, progress < 0.9);
|
|
93
|
+
// Wait for next frame
|
|
94
|
+
await new Promise(resolve => setTimeout(resolve, ANIMATION_SPEED));
|
|
95
|
+
}
|
|
96
|
+
// Final reveal with flashing
|
|
97
|
+
const finalChars = finalHash.split('');
|
|
98
|
+
// Flash 3 times if there are highlighted characters
|
|
99
|
+
if (highlightIndices.length > 0) {
|
|
100
|
+
for (let flashCount = 0; flashCount < 3; flashCount++) {
|
|
101
|
+
// Flash on
|
|
102
|
+
console.clear();
|
|
103
|
+
drawSlotMachine(finalChars, false, highlightIndices, true);
|
|
104
|
+
await new Promise(resolve => setTimeout(resolve, 200));
|
|
105
|
+
// Flash off
|
|
106
|
+
console.clear();
|
|
107
|
+
drawSlotMachine(finalChars, false, highlightIndices, false);
|
|
108
|
+
await new Promise(resolve => setTimeout(resolve, 200));
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
// Steady state
|
|
112
|
+
console.clear();
|
|
113
|
+
drawSlotMachine(finalChars, false, highlightIndices, false);
|
|
114
|
+
}
|
|
115
|
+
async function animateSmallMode(config) {
|
|
116
|
+
const { finalHash, patternResult } = config;
|
|
117
|
+
const highlightIndices = patternResult?.highlightIndices || [];
|
|
118
|
+
// Single line, rapid character flicker
|
|
119
|
+
process.stdout.write(chalk_1.default.cyan('🎰 '));
|
|
120
|
+
for (let frame = 0; frame < 20; frame++) {
|
|
121
|
+
const chars = Array(7).fill(0).map(() => getRandomHexChar()).join('');
|
|
122
|
+
clearLine();
|
|
123
|
+
process.stdout.write(chalk_1.default.cyan('🎰 ') + chalk_1.default.rgb(255, 255, 255)(chars));
|
|
124
|
+
await new Promise(resolve => setTimeout(resolve, 50));
|
|
125
|
+
}
|
|
126
|
+
// Final with highlighting - don't add newline, let the caller add result info
|
|
127
|
+
clearLine();
|
|
128
|
+
const display = finalHash.split('').map((char, i) => {
|
|
129
|
+
if (highlightIndices.includes(i)) {
|
|
130
|
+
return chalk_1.default.bgRgb(255, 255, 0).rgb(0, 0, 0).bold(char);
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
return chalk_1.default.rgb(255, 255, 255)(char);
|
|
134
|
+
}
|
|
135
|
+
}).join('');
|
|
136
|
+
process.stdout.write(chalk_1.default.cyan('🎰 ') + display);
|
|
137
|
+
// Don't write newline - let caller continue on same line
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=slotMachine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slotMachine.js","sourceRoot":"","sources":["../../src/animation/slotMachine.ts"],"names":[],"mappings":";;;;;AA4EA,gDAuDC;AAED,4CAyBC;AA9JD,kDAA0B;AAG1B,MAAM,SAAS,GAAG,kBAAkB,CAAC,KAA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CAAC,CAAC,CAAC;QAC1E,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;IACxD,CAAC;IAED,8EAA8E;IAC9E,SAAS,EAAE,CAAC;IACZ,MAAM,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE;QAClD,IAAI,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;YACjC,OAAO,eAAK,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1D,CAAC;aAAM,CAAC;YACN,OAAO,eAAK,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC;QACxC,CAAC;IACH,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACZ,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,eAAK,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC;IAClD,yDAAyD;AAC3D,CAAC"}
|
package/dist/api.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export interface PlayData {
|
|
2
|
+
commit_hash: string;
|
|
3
|
+
commit_full_hash: string;
|
|
4
|
+
pattern_type: string;
|
|
5
|
+
pattern_name: string;
|
|
6
|
+
payout: number;
|
|
7
|
+
wager: number;
|
|
8
|
+
balance_before: number;
|
|
9
|
+
balance_after: number;
|
|
10
|
+
repo_url: string;
|
|
11
|
+
github_username: string;
|
|
12
|
+
repo_owner: string;
|
|
13
|
+
repo_name: string;
|
|
14
|
+
}
|
|
15
|
+
export interface ApiResponse<T = any> {
|
|
16
|
+
success: boolean;
|
|
17
|
+
data?: T;
|
|
18
|
+
message?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface BalanceResponse {
|
|
21
|
+
balance: number;
|
|
22
|
+
total_commits: number;
|
|
23
|
+
total_winnings: number;
|
|
24
|
+
biggest_win: number;
|
|
25
|
+
biggest_win_pattern?: string;
|
|
26
|
+
biggest_win_hash?: string;
|
|
27
|
+
}
|
|
28
|
+
export declare function isApiAvailable(): boolean;
|
|
29
|
+
export interface PlayResponse {
|
|
30
|
+
balance: number;
|
|
31
|
+
payout: number;
|
|
32
|
+
pattern_name: string;
|
|
33
|
+
share_url?: string;
|
|
34
|
+
}
|
|
35
|
+
export declare function sendPlayToAPI(data: PlayData): Promise<PlayResponse | null>;
|
|
36
|
+
export declare function getBalance(): Promise<BalanceResponse | null>;
|
|
37
|
+
export declare function createToken(githubUsername: string): Promise<string | null>;
|
|
38
|
+
export declare function verifyToken(token: string): Promise<boolean>;
|
|
39
|
+
export declare function logout(): Promise<boolean>;
|
|
40
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,QAAQ;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,GAAG;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE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