@infiniteezverse/monskills-ezpath 0.1.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/.well-known/agent.json +241 -0
- package/.well-known/openapi.json +310 -0
- package/ARENA.md +551 -0
- package/DEPLOYMENT.md +460 -0
- package/LAUNCH.md +345 -0
- package/LICENSE +24 -0
- package/MANIFEST.md +356 -0
- package/MONAD.md +375 -0
- package/QUICKSTART.md +378 -0
- package/README.md +88 -0
- package/X402_IMPLEMENTATION.md +468 -0
- package/dist/agents/arena-agent.d.ts +166 -0
- package/dist/agents/arena-agent.d.ts.map +1 -0
- package/dist/agents/arena-agent.js +267 -0
- package/dist/agents/arena-agent.js.map +1 -0
- package/dist/agents/bankroll-manager.d.ts +114 -0
- package/dist/agents/bankroll-manager.d.ts.map +1 -0
- package/dist/agents/bankroll-manager.js +293 -0
- package/dist/agents/bankroll-manager.js.map +1 -0
- package/dist/agents/index.d.ts +9 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +29 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/strategy.d.ts +48 -0
- package/dist/agents/strategy.d.ts.map +1 -0
- package/dist/agents/strategy.js +265 -0
- package/dist/agents/strategy.js.map +1 -0
- package/dist/agents/types.d.ts +197 -0
- package/dist/agents/types.d.ts.map +1 -0
- package/dist/agents/types.js +7 -0
- package/dist/agents/types.js.map +1 -0
- package/dist/config/monad.d.ts +175 -0
- package/dist/config/monad.d.ts.map +1 -0
- package/dist/config/monad.js +222 -0
- package/dist/config/monad.js.map +1 -0
- package/dist/index.d.ts +47 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +153 -0
- package/dist/index.js.map +1 -0
- package/dist/payments/eip3009.d.ts +210 -0
- package/dist/payments/eip3009.d.ts.map +1 -0
- package/dist/payments/eip3009.js +261 -0
- package/dist/payments/eip3009.js.map +1 -0
- package/dist/payments/index.d.ts +8 -0
- package/dist/payments/index.d.ts.map +1 -0
- package/dist/payments/index.js +25 -0
- package/dist/payments/index.js.map +1 -0
- package/dist/payments/quote-execution.d.ts +76 -0
- package/dist/payments/quote-execution.d.ts.map +1 -0
- package/dist/payments/quote-execution.js +285 -0
- package/dist/payments/quote-execution.js.map +1 -0
- package/dist/types/ezpath.d.ts +65 -0
- package/dist/types/ezpath.d.ts.map +1 -0
- package/dist/types/ezpath.js +7 -0
- package/dist/types/ezpath.js.map +1 -0
- package/package.json +42 -0
package/ARENA.md
ADDED
|
@@ -0,0 +1,551 @@
|
|
|
1
|
+
# Arena Agent Framework
|
|
2
|
+
|
|
3
|
+
Complete guide for building poker-style competition agents using the EZ-Path MONSKILLS plugin.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The Arena Agent Framework provides:
|
|
8
|
+
|
|
9
|
+
- **Bankroll Management** — Real-time valuation via EZ-Path pricing
|
|
10
|
+
- **Risk Calculations** — Risk of ruin, optimal buyin sizing
|
|
11
|
+
- **Strategy Engine** — Dynamic strategy selection based on bankroll
|
|
12
|
+
- **Tournament Integration** — Join, play, and exit tournaments
|
|
13
|
+
- **Performance Tracking** — Historical data and analytics
|
|
14
|
+
|
|
15
|
+
## Quick Start
|
|
16
|
+
|
|
17
|
+
### 1. Create an Agent
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import { Agent } from '@infiniteezverse/monskills-ezpath/dist/agents';
|
|
21
|
+
|
|
22
|
+
const agent = new Agent({
|
|
23
|
+
id: 'my-agent-001',
|
|
24
|
+
name: 'AlphaPoker',
|
|
25
|
+
address: '0x1234567890123456789012345678901234567890',
|
|
26
|
+
chain: 'monad',
|
|
27
|
+
bankrollToken: '0x4200000000000000000000000000000000000006', // WETH
|
|
28
|
+
initialBankroll: BigInt('10000000000000000000'), // 10 WETH
|
|
29
|
+
minimumBankroll: BigInt('500000000000000000'), // 0.5 WETH
|
|
30
|
+
skillLevel: 'advanced',
|
|
31
|
+
strategy: 'balanced',
|
|
32
|
+
aggressivenessLevel: 0.6,
|
|
33
|
+
riskTolerance: 0.5,
|
|
34
|
+
targetROI: 0.2, // 20% monthly
|
|
35
|
+
});
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### 2. Check Status
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
const status = await agent.getStatus();
|
|
42
|
+
|
|
43
|
+
console.log(`Bankroll: ${status.bankroll.inUSDC} USDC`);
|
|
44
|
+
console.log(`Buyins: ${status.bankroll.buyinsRemaining}`);
|
|
45
|
+
console.log(`Risk: ${status.risk.riskOfRuin}`);
|
|
46
|
+
console.log(`Strategy: ${status.strategy.recommended}`);
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### 3. Join Tournament
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
const tournament = {
|
|
53
|
+
id: 'tournament-001',
|
|
54
|
+
name: 'Friday Night',
|
|
55
|
+
chain: 'monad',
|
|
56
|
+
totalPlayers: 50,
|
|
57
|
+
entryFee: BigInt('1000000000000000000'), // 1 WETH
|
|
58
|
+
// ... other fields
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const joined = await agent.joinTournament(tournament, tournament.entryFee);
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### 4. Play & Exit
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
// Play hands
|
|
68
|
+
await agent.playHand('AK', 20); // AK with 20 BB stack
|
|
69
|
+
|
|
70
|
+
// Exit tournament
|
|
71
|
+
agent.exitTournament(
|
|
72
|
+
5, // Finish position
|
|
73
|
+
BigInt('0'), // Final stack
|
|
74
|
+
BigInt('2500000000000000000') // Prize (2.5 WETH)
|
|
75
|
+
);
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Agent Configuration
|
|
79
|
+
|
|
80
|
+
### Required Fields
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
interface AgentConfig {
|
|
84
|
+
id: string; // Unique agent ID
|
|
85
|
+
name: string; // Display name
|
|
86
|
+
address: '0x' + string; // Wallet address
|
|
87
|
+
chain: 'base' | 'monad'; // Chain to operate on
|
|
88
|
+
bankrollToken: '0x' + string; // Token for bankroll
|
|
89
|
+
initialBankroll: bigint; // Starting amount
|
|
90
|
+
minimumBankroll: bigint; // Bust-out threshold
|
|
91
|
+
skillLevel: 'beginner' | 'intermediate' | 'advanced' | 'expert';
|
|
92
|
+
strategy: 'aggressive' | 'balanced' | 'conservative' | 'adaptive';
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Optional Fields
|
|
97
|
+
|
|
98
|
+
```typescript
|
|
99
|
+
interface AgentConfig {
|
|
100
|
+
aggressivenessLevel?: number; // 0-1, default 0.5
|
|
101
|
+
riskTolerance?: number; // 0-1, default 0.4
|
|
102
|
+
targetROI?: number; // Default 0.2 (20%)
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Bankroll Management
|
|
107
|
+
|
|
108
|
+
### Get Current Metrics
|
|
109
|
+
|
|
110
|
+
```typescript
|
|
111
|
+
const metrics = await agent.getMetrics();
|
|
112
|
+
|
|
113
|
+
console.log(`Value: ${metrics.valueInUSDC}`); // USDC valuation
|
|
114
|
+
console.log(`Buyins: ${metrics.buyinsRemaining}`); // Number of buyins
|
|
115
|
+
console.log(`RoR: ${metrics.riskOfRuin}`); // Risk of ruin (0-1)
|
|
116
|
+
console.log(`Status: ${metrics.status}`); // healthy|cautious|critical|bust
|
|
117
|
+
console.log(`Health: ${metrics.healthScore}/100`); // Overall health
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Bankroll Status Levels
|
|
121
|
+
|
|
122
|
+
| Status | Buyins | RoR | Meaning |
|
|
123
|
+
|--------|--------|-----|---------|
|
|
124
|
+
| **healthy** | 20+ | <5% | Safe to play normally |
|
|
125
|
+
| **cautious** | 10-20 | 5-20% | Play carefully |
|
|
126
|
+
| **critical** | 5-10 | 20-50% | Very risky |
|
|
127
|
+
| **bust** | <5 | >50% | Stop playing |
|
|
128
|
+
|
|
129
|
+
### Can Agent Afford Tournament?
|
|
130
|
+
|
|
131
|
+
```typescript
|
|
132
|
+
const buyin = BigInt('1000000000000000000');
|
|
133
|
+
|
|
134
|
+
// Check affordability
|
|
135
|
+
if (agent.bankrollManager.canAffordBuyin(buyin)) {
|
|
136
|
+
// Bankroll > buyin
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// Check bankroll management rules
|
|
140
|
+
const shouldPlay = agent.bankrollManager.shouldPlayTournament(
|
|
141
|
+
buyin,
|
|
142
|
+
50 // field size
|
|
143
|
+
);
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Record Tournament Results
|
|
147
|
+
|
|
148
|
+
```typescript
|
|
149
|
+
agent.bankrollManager.recordTournamentResult(
|
|
150
|
+
'tournament-001',
|
|
151
|
+
buyin, // Amount paid
|
|
152
|
+
profit // Amount won - buyin
|
|
153
|
+
);
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Strategy Engine
|
|
157
|
+
|
|
158
|
+
### Get Strategy Recommendation
|
|
159
|
+
|
|
160
|
+
```typescript
|
|
161
|
+
const recommendation = await agent.getStrategyRecommendation();
|
|
162
|
+
|
|
163
|
+
console.log(`Current: ${recommendation.currentStrategy}`);
|
|
164
|
+
console.log(`Recommended: ${recommendation.recommendedStrategy}`);
|
|
165
|
+
console.log(`Confidence: ${recommendation.confidence}`); // 0-1
|
|
166
|
+
|
|
167
|
+
console.log('Suggestions:');
|
|
168
|
+
recommendation.suggestions.forEach(s => console.log(` • ${s}`));
|
|
169
|
+
|
|
170
|
+
if (recommendation.warningFlags.length > 0) {
|
|
171
|
+
console.log('Warnings:');
|
|
172
|
+
recommendation.warningFlags.forEach(w => console.log(` ⚠️ ${w}`));
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Strategy Modes
|
|
177
|
+
|
|
178
|
+
#### Aggressive
|
|
179
|
+
```typescript
|
|
180
|
+
strategy: 'aggressive'
|
|
181
|
+
|
|
182
|
+
// When to use:
|
|
183
|
+
// - Bankroll > 30 buyins
|
|
184
|
+
// - Risk of ruin < 5%
|
|
185
|
+
// - Advanced skill level
|
|
186
|
+
|
|
187
|
+
// Play style:
|
|
188
|
+
// - Wide opening ranges
|
|
189
|
+
// - Frequent 3-bets
|
|
190
|
+
// - Marginal situations OK
|
|
191
|
+
// - Variance is expected
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
#### Balanced
|
|
195
|
+
```typescript
|
|
196
|
+
strategy: 'balanced'
|
|
197
|
+
|
|
198
|
+
// When to use:
|
|
199
|
+
// - Bankroll 15-100 buyins
|
|
200
|
+
// - Risk of ruin 5-20%
|
|
201
|
+
// - Any skill level
|
|
202
|
+
|
|
203
|
+
// Play style:
|
|
204
|
+
// - Standard poker fundamentals
|
|
205
|
+
// - Mix aggression with caution
|
|
206
|
+
// - Adaptive to table
|
|
207
|
+
// - Steady growth
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
#### Conservative
|
|
211
|
+
```typescript
|
|
212
|
+
strategy: 'conservative'
|
|
213
|
+
|
|
214
|
+
// When to use:
|
|
215
|
+
// - Bankroll < 10 buyins
|
|
216
|
+
// - Risk of ruin > 20%
|
|
217
|
+
// - Building back up
|
|
218
|
+
|
|
219
|
+
// Play style:
|
|
220
|
+
// - Premium hands only
|
|
221
|
+
// - Minimize variance
|
|
222
|
+
// - Avoid marginal spots
|
|
223
|
+
// - Preserve bankroll
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
#### Adaptive
|
|
227
|
+
```typescript
|
|
228
|
+
strategy: 'adaptive'
|
|
229
|
+
|
|
230
|
+
// When to use:
|
|
231
|
+
// - Tournament conditions vary
|
|
232
|
+
// - Need flexibility
|
|
233
|
+
// - Mixed field skills
|
|
234
|
+
|
|
235
|
+
// Play style:
|
|
236
|
+
// - Adjust based on situation
|
|
237
|
+
// - Read opponents
|
|
238
|
+
// - Exploit weaknesses
|
|
239
|
+
// - Balance all factors
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Update Strategy Dynamically
|
|
243
|
+
|
|
244
|
+
```typescript
|
|
245
|
+
const updated = await agent.updateStrategyIfNeeded();
|
|
246
|
+
|
|
247
|
+
if (updated) {
|
|
248
|
+
console.log(`Strategy updated to ${agent.strategy}`);
|
|
249
|
+
}
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
## Tournament Participation
|
|
253
|
+
|
|
254
|
+
### Join Tournament
|
|
255
|
+
|
|
256
|
+
```typescript
|
|
257
|
+
const joined = await agent.joinTournament(tournament, buyin);
|
|
258
|
+
|
|
259
|
+
if (!joined) {
|
|
260
|
+
console.log('Could not join. Reasons:');
|
|
261
|
+
// - Cannot afford buyin
|
|
262
|
+
// - Bankroll management rules violated
|
|
263
|
+
// - Risk of ruin too high
|
|
264
|
+
}
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
### Play Hands
|
|
268
|
+
|
|
269
|
+
```typescript
|
|
270
|
+
await agent.playHand('AK', 20); // Hand type, stack in BB
|
|
271
|
+
|
|
272
|
+
// Hand types supported:
|
|
273
|
+
// - Pocket pairs: 'AA', 'KK', 'QQ', etc.
|
|
274
|
+
// - Unsuited: 'AK', 'QJ', etc.
|
|
275
|
+
// - Suited: 'AS', 'KS', etc.
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
### Exit Tournament
|
|
279
|
+
|
|
280
|
+
```typescript
|
|
281
|
+
agent.exitTournament(
|
|
282
|
+
finishPosition, // Where agent finished (1-50)
|
|
283
|
+
finalStack, // Remaining chips (usually 0 if busted)
|
|
284
|
+
prizeAmount // Amount won
|
|
285
|
+
);
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
### Tournament Entry State
|
|
289
|
+
|
|
290
|
+
```typescript
|
|
291
|
+
interface TournamentEntry {
|
|
292
|
+
tournamentId: string;
|
|
293
|
+
agentId: string;
|
|
294
|
+
entryFee: bigint;
|
|
295
|
+
initialStack: bigint;
|
|
296
|
+
currentStack: bigint;
|
|
297
|
+
position: number;
|
|
298
|
+
handsPlayed: number;
|
|
299
|
+
handsWon: number;
|
|
300
|
+
handsLost: number;
|
|
301
|
+
totalWinnings: bigint;
|
|
302
|
+
totalLosses: bigint;
|
|
303
|
+
isActive: boolean;
|
|
304
|
+
bustedAt?: number;
|
|
305
|
+
finishPosition?: number;
|
|
306
|
+
joinedAt: number;
|
|
307
|
+
exitedAt?: number;
|
|
308
|
+
}
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
## Decision Making
|
|
312
|
+
|
|
313
|
+
### Get Game Decision
|
|
314
|
+
|
|
315
|
+
```typescript
|
|
316
|
+
const decision = agent.makeDecision({
|
|
317
|
+
strategy: recommendation,
|
|
318
|
+
metrics: metrics,
|
|
319
|
+
position: 'late', // early|middle|late|button
|
|
320
|
+
stackInBuyins: 15,
|
|
321
|
+
potOdds: 2.5,
|
|
322
|
+
chipStack: BigInt('1500')
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
console.log(`Action: ${decision.action}`); // fold|check|call|raise|all-in
|
|
326
|
+
console.log(`Confidence: ${decision.confidence}`); // 0-1
|
|
327
|
+
console.log(`Reason: ${decision.reasoning}`);
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
## Use Cases
|
|
331
|
+
|
|
332
|
+
### 1. Automated Tournament Agent
|
|
333
|
+
|
|
334
|
+
```typescript
|
|
335
|
+
// Create agent
|
|
336
|
+
const agent = new Agent(config);
|
|
337
|
+
|
|
338
|
+
// Join tournaments in loop
|
|
339
|
+
for (const tournament of tournaments) {
|
|
340
|
+
const joined = await agent.joinTournament(tournament, buyin);
|
|
341
|
+
|
|
342
|
+
if (joined) {
|
|
343
|
+
// Play hands
|
|
344
|
+
while (agent.tournamentEntry?.isActive) {
|
|
345
|
+
const decision = agent.makeDecision(context);
|
|
346
|
+
executeDecision(decision);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
// Exit
|
|
350
|
+
agent.exitTournament(position, finalStack, prize);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
### 2. Bankroll Simulator
|
|
356
|
+
|
|
357
|
+
```typescript
|
|
358
|
+
const agent = new Agent(config);
|
|
359
|
+
|
|
360
|
+
// Simulate 1000 hands
|
|
361
|
+
for (let i = 0; i < 1000; i++) {
|
|
362
|
+
const result = simulateHand(agent.strategy);
|
|
363
|
+
agent.currentBankroll += result.profit;
|
|
364
|
+
(agent as any).bankrollManager.updateBankroll(agent.currentBankroll);
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
const metrics = await agent.getMetrics();
|
|
368
|
+
console.log(`Final bankroll: ${metrics.valueInUSDC}`);
|
|
369
|
+
console.log(`ROI: ${metrics.totalROI}%`);
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
### 3. Strategy A/B Test
|
|
373
|
+
|
|
374
|
+
```typescript
|
|
375
|
+
// Create two agents with different strategies
|
|
376
|
+
const aggressiveAgent = new Agent({ ...config, strategy: 'aggressive' });
|
|
377
|
+
const conservativeAgent = new Agent({ ...config, strategy: 'conservative' });
|
|
378
|
+
|
|
379
|
+
// Run same tournaments
|
|
380
|
+
const results = await runTournaments([aggressiveAgent, conservativeAgent]);
|
|
381
|
+
|
|
382
|
+
// Compare performance
|
|
383
|
+
console.log(`Aggressive ROI: ${results[0].roi}`);
|
|
384
|
+
console.log(`Conservative ROI: ${results[1].roi}`);
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
## Performance Tracking
|
|
388
|
+
|
|
389
|
+
### Get Agent History
|
|
390
|
+
|
|
391
|
+
```typescript
|
|
392
|
+
// Last 24 records
|
|
393
|
+
const history = agent.bankrollManager.getHistory();
|
|
394
|
+
|
|
395
|
+
// Since timestamp
|
|
396
|
+
const recent = agent.bankrollManager.getHistory(Date.now() - 86400000);
|
|
397
|
+
|
|
398
|
+
// Each record includes:
|
|
399
|
+
// - timestamp
|
|
400
|
+
// - bankroll
|
|
401
|
+
// - valueInUSDC
|
|
402
|
+
// - tournamentId (if applicable)
|
|
403
|
+
// - buyin / profit
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
### Bankroll Trend
|
|
407
|
+
|
|
408
|
+
```typescript
|
|
409
|
+
const trend = agent.bankrollManager.getRecentTrend();
|
|
410
|
+
|
|
411
|
+
// 'up' | 'down' | 'flat' (last 24 hours)
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
### Export Agent State
|
|
415
|
+
|
|
416
|
+
```typescript
|
|
417
|
+
const exported = await agent.toJSON();
|
|
418
|
+
|
|
419
|
+
// Includes:
|
|
420
|
+
// - Agent config
|
|
421
|
+
// - Current bankroll
|
|
422
|
+
// - Metrics
|
|
423
|
+
// - Status
|
|
424
|
+
// - Timestamps
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
## Examples
|
|
428
|
+
|
|
429
|
+
Complete working examples in `/examples/`:
|
|
430
|
+
|
|
431
|
+
- **`arena-agent-template.ts`** — Full Arena agent examples with 9 use cases
|
|
432
|
+
|
|
433
|
+
Run examples:
|
|
434
|
+
|
|
435
|
+
```bash
|
|
436
|
+
npm install
|
|
437
|
+
npx ts-node examples/arena-agent-template.ts
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
## Integration with EZ-Path
|
|
441
|
+
|
|
442
|
+
The Agent framework uses EZ-Path for real-time bankroll valuation:
|
|
443
|
+
|
|
444
|
+
```typescript
|
|
445
|
+
import { getPrice } from '@infiniteezverse/monskills-ezpath';
|
|
446
|
+
|
|
447
|
+
// Get WETH/USDC price
|
|
448
|
+
const price = await getPrice(
|
|
449
|
+
'monad',
|
|
450
|
+
'0x4200000000000000000000000000000000000006', // WETH
|
|
451
|
+
'0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913', // USDC
|
|
452
|
+
agentBankrollAmount
|
|
453
|
+
);
|
|
454
|
+
|
|
455
|
+
// Price is now available for risk calculations
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
## Advanced Patterns
|
|
459
|
+
|
|
460
|
+
### Custom Risk Calculations
|
|
461
|
+
|
|
462
|
+
```typescript
|
|
463
|
+
class CustomAgent extends Agent {
|
|
464
|
+
async getCustomRiskOfRuin(): Promise<number> {
|
|
465
|
+
const metrics = await this.getMetrics();
|
|
466
|
+
const winRate = estimateWinRateFromHistory();
|
|
467
|
+
|
|
468
|
+
// Custom calculation
|
|
469
|
+
return customRoRFormula(metrics.buyinsRemaining, winRate);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
### Strategy Overrides
|
|
475
|
+
|
|
476
|
+
```typescript
|
|
477
|
+
const recommendation = await agent.getStrategyRecommendation();
|
|
478
|
+
|
|
479
|
+
// Override recommendation
|
|
480
|
+
if (specialCondition) {
|
|
481
|
+
agent.strategy = 'custom-strategy';
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
// Make decision
|
|
485
|
+
const decision = agent.makeDecision(context);
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
### Tournament Chains
|
|
489
|
+
|
|
490
|
+
```typescript
|
|
491
|
+
// Join multiple tournaments in sequence
|
|
492
|
+
for (const tournament of tournamentSchedule) {
|
|
493
|
+
await agent.joinTournament(tournament, calculateOptimalBuyin(agent));
|
|
494
|
+
|
|
495
|
+
// Play tournament...
|
|
496
|
+
|
|
497
|
+
agent.exitTournament(position, finalStack, prize);
|
|
498
|
+
|
|
499
|
+
// Check if should continue
|
|
500
|
+
const metrics = await agent.getMetrics();
|
|
501
|
+
if (metrics.status === 'bust') break;
|
|
502
|
+
}
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
## Troubleshooting
|
|
506
|
+
|
|
507
|
+
### Agent shows "bust" status but bankroll > minimum
|
|
508
|
+
|
|
509
|
+
**Cause:** Calculation issue or stale cache
|
|
510
|
+
**Solution:** Manually refresh metrics
|
|
511
|
+
|
|
512
|
+
```typescript
|
|
513
|
+
const metrics = await agent.getMetrics();
|
|
514
|
+
// Metrics are always calculated fresh
|
|
515
|
+
```
|
|
516
|
+
|
|
517
|
+
### Strategy not updating
|
|
518
|
+
|
|
519
|
+
**Cause:** Confidence threshold too high (>0.7)
|
|
520
|
+
**Solution:** Force update or lower threshold
|
|
521
|
+
|
|
522
|
+
```typescript
|
|
523
|
+
// Force update
|
|
524
|
+
agent.strategy = 'conservative';
|
|
525
|
+
|
|
526
|
+
// Or check confidence
|
|
527
|
+
if (recommendation.confidence > 0.5) {
|
|
528
|
+
agent.strategy = recommendation.recommendedStrategy;
|
|
529
|
+
}
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
### Unrealistic tournament results
|
|
533
|
+
|
|
534
|
+
**Cause:** Simulation is simplified
|
|
535
|
+
**Solution:** Review `playHand()` logic
|
|
536
|
+
|
|
537
|
+
```typescript
|
|
538
|
+
// Current simulation:
|
|
539
|
+
// - Hand strength determines win probability
|
|
540
|
+
// - Fixed chip amounts per hand
|
|
541
|
+
// - No pot odds consideration
|
|
542
|
+
|
|
543
|
+
// For production: implement full game simulation
|
|
544
|
+
```
|
|
545
|
+
|
|
546
|
+
## Support
|
|
547
|
+
|
|
548
|
+
- 📖 Full code: https://github.com/infiniteezverse/monskills-ezpath/src/agents/
|
|
549
|
+
- 💬 Monad Discord: https://discord.gg/monad
|
|
550
|
+
- 🐦 Twitter: @infiniteezverse
|
|
551
|
+
- 📦 NPM: @infiniteezverse/monskills-ezpath
|