@vibemancer/core 0.1.4 → 0.1.6
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 +2 -2
- package/dist/chunk-G5T65F3W.js +10617 -0
- package/dist/chunk-G5T65F3W.js.map +1 -0
- package/dist/index-browser.d.ts +1328 -1051
- package/dist/index-browser.js +59 -17
- package/dist/index.d.ts +53 -3
- package/dist/index.js +204 -54
- package/dist/index.js.map +1 -1
- package/package.json +21 -15
- package/src/banned-bot-names.ts +53 -0
- package/src/bots/Hero.ts +867 -0
- package/src/bots/berserker/01_Stormchaser.ts +162 -120
- package/src/bots/berserker/02_Stormcaller.ts +160 -116
- package/src/bots/berserker/03_Stormforger.ts +162 -129
- package/src/bots/caster/01_Flamecaller.ts +126 -84
- package/src/bots/caster/02_Pyromancer.ts +148 -101
- package/src/bots/caster/03_Infernalist.ts +180 -160
- package/src/bots/defensive/01_Turtle.ts +48 -44
- package/src/bots/defensive/02_Sentinel.ts +57 -53
- package/src/bots/defensive/03_Golem.ts +85 -97
- package/src/bots/duelist/01_Battlemage.ts +157 -122
- package/src/bots/duelist/02_Warmage.ts +166 -121
- package/src/bots/duelist/03_Archmage.ts +198 -178
- package/src/bots/homing/01_Bonemancer.ts +20 -32
- package/src/bots/homing/02_Lich.ts +145 -93
- package/src/bots/homing/03_Archlich.ts +129 -60
- package/src/bots/kiter/01_Spellspinner.ts +145 -107
- package/src/bots/kiter/02_Spellweaver.ts +153 -105
- package/src/bots/kiter/03_Spellbinder.ts +168 -123
- package/src/bots/melee/01_Shadowblade.ts +131 -75
- package/src/bots/melee/02_Nightblade.ts +174 -130
- package/src/bots/melee/03_Voidblade.ts +266 -168
- package/src/bots/registry.ts +44 -37
- package/src/bots/shared.ts +185 -25
- package/src/bots/sniper/01_Spellshot.ts +151 -98
- package/src/bots/sniper/02_Spelltracer.ts +173 -128
- package/src/bots/sniper/03_Spellseeker.ts +177 -152
- package/src/bots/standalone/Critter.ts +46 -52
- package/src/bots/standalone/Doombringer.ts +36 -40
- package/src/bots/standalone/Hogger.ts +120 -89
- package/src/bots/standalone/Rookie.ts +21 -23
- package/src/bots/standalone/TargetDummy.ts +5 -6
- package/src/bots/test/cheater.ts +91 -85
- package/src/bots/test/crasher.ts +26 -28
- package/src/engine/bundle-fight.ts +242 -0
- package/src/engine/hooks-runtime.ts +58 -18
- package/src/engine/manual-match.ts +33 -25
- package/src/engine/missile-templates.ts +25 -43
- package/src/engine/optimizer.ts +7 -7
- package/src/engine/params-runtime.ts +3 -3
- package/src/engine/physics.ts +33 -23
- package/src/engine/sandbox-browser.ts +8 -7
- package/src/engine/sandbox-compile.ts +1 -1
- package/src/engine/sandbox-harness.ts +299 -367
- package/src/engine/sandbox.ts +3 -3
- package/src/engine/simulation.ts +291 -76
- package/src/engine/spells.ts +9 -12
- package/src/engine-version.ts +1 -1
- package/src/hooks/action-builders.ts +76 -21
- package/src/hooks/index.ts +17 -9
- package/src/hooks/state-hooks.ts +61 -25
- package/src/hooks/threat-analysis.ts +44 -20
- package/src/hooks/types.ts +62 -5
- package/src/index-browser.ts +1 -0
- package/src/index.ts +3 -0
- package/src/rules.ts +209 -63
- package/src/stats.ts +2 -2
- package/src/testing.ts +6 -30
- package/src/trace.ts +63 -3
- package/src/types.ts +127 -14
- package/src/utils/angles.ts +1 -0
- package/src/utils/combat.ts +98 -6
- package/src/utils/spatial.ts +3 -3
- package/dist/chunk-74FFJCFF.js +0 -9140
- package/dist/chunk-74FFJCFF.js.map +0 -1
- package/src/hooks/bot-wrapper.ts +0 -84
package/dist/index-browser.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ALL_BOTS,
|
|
3
|
-
|
|
3
|
+
ARENA_MAX,
|
|
4
|
+
ARENA_MIN,
|
|
4
5
|
ARENA_SIZE,
|
|
5
6
|
ARENA_WATER_BUFFER,
|
|
6
|
-
ARENA_WIDTH,
|
|
7
7
|
Archlich,
|
|
8
8
|
Archmage,
|
|
9
9
|
BLINK_CAST_TIME,
|
|
@@ -28,6 +28,11 @@ import {
|
|
|
28
28
|
Golem,
|
|
29
29
|
Hogger,
|
|
30
30
|
Infernalist,
|
|
31
|
+
KNOCKBACK_DAMAGE_THRESHOLD,
|
|
32
|
+
KNOCKBACK_DECAY,
|
|
33
|
+
KNOCKBACK_DELAY,
|
|
34
|
+
KNOCKBACK_SPEED_PER_DAMAGE,
|
|
35
|
+
LAVA_BORDER_WIDTH,
|
|
31
36
|
Lich,
|
|
32
37
|
MATCH_DURATION,
|
|
33
38
|
MAX_HEALTH,
|
|
@@ -50,6 +55,8 @@ import {
|
|
|
50
55
|
ManualMatch,
|
|
51
56
|
Nightblade,
|
|
52
57
|
Pyromancer,
|
|
58
|
+
RULES,
|
|
59
|
+
RULESET_RANGES,
|
|
53
60
|
Rookie,
|
|
54
61
|
SHIELD_CAST_TIME,
|
|
55
62
|
SHIELD_DECAY_PER_SECOND,
|
|
@@ -87,8 +94,8 @@ import {
|
|
|
87
94
|
angleDiff,
|
|
88
95
|
angleInRange,
|
|
89
96
|
angleTo,
|
|
90
|
-
antiHomingMissile,
|
|
91
97
|
applyDamage,
|
|
98
|
+
applyRulesetOverrides,
|
|
92
99
|
blink,
|
|
93
100
|
browserSandboxFight,
|
|
94
101
|
browserSandboxSimulate,
|
|
@@ -109,18 +116,22 @@ import {
|
|
|
109
116
|
createInitialState,
|
|
110
117
|
createRandom,
|
|
111
118
|
createWorkerScript,
|
|
119
|
+
currentRuleset,
|
|
112
120
|
diagnoseTrace,
|
|
113
121
|
directionAway,
|
|
114
122
|
directionTo,
|
|
115
123
|
distanceTo,
|
|
116
124
|
effectiveTurnRateCost,
|
|
117
125
|
extractAction,
|
|
126
|
+
extractMissileAction,
|
|
118
127
|
extractStats,
|
|
119
128
|
extractTraceEvents,
|
|
120
129
|
fight,
|
|
121
130
|
findInRange,
|
|
122
131
|
findNearest,
|
|
132
|
+
fitMissileForEscapingTarget,
|
|
123
133
|
fitMissileToBudget,
|
|
134
|
+
flyStraight,
|
|
124
135
|
formatDiagnosis,
|
|
125
136
|
formatStats,
|
|
126
137
|
formatTraceEvents,
|
|
@@ -128,18 +139,21 @@ import {
|
|
|
128
139
|
generateCandidates,
|
|
129
140
|
generateCombos,
|
|
130
141
|
getAdaptiveMissileConfig,
|
|
131
|
-
getBotContext,
|
|
132
142
|
getEffectiveRange,
|
|
133
143
|
getLeadPosition,
|
|
134
144
|
getMissileCastTime,
|
|
145
|
+
getMissileContext,
|
|
135
146
|
getPlayerState,
|
|
147
|
+
getWizardContext,
|
|
136
148
|
hashCombine,
|
|
137
149
|
homingMissile,
|
|
138
150
|
idle,
|
|
139
151
|
inRange,
|
|
140
152
|
interceptAngle,
|
|
141
|
-
|
|
153
|
+
isBannedBotName,
|
|
154
|
+
isInLava,
|
|
142
155
|
magnitude,
|
|
156
|
+
matchesAnyBanRule,
|
|
143
157
|
missile,
|
|
144
158
|
move,
|
|
145
159
|
moveInDirection,
|
|
@@ -151,15 +165,17 @@ import {
|
|
|
151
165
|
normalizeAngle,
|
|
152
166
|
predictPosition,
|
|
153
167
|
resetAllHooks,
|
|
168
|
+
resetRuleset,
|
|
154
169
|
resolveWizardCollision,
|
|
155
|
-
runBotWithContext,
|
|
156
170
|
runWithHooks,
|
|
171
|
+
runWizardWithContext,
|
|
157
172
|
scoreFight,
|
|
158
173
|
scoreFightAsWizard2,
|
|
159
174
|
seekerMissile,
|
|
160
175
|
setParamValues,
|
|
161
176
|
shield,
|
|
162
177
|
simulate,
|
|
178
|
+
simulateMinDuration,
|
|
163
179
|
sortByDistance,
|
|
164
180
|
spiralMissile,
|
|
165
181
|
startCast,
|
|
@@ -170,6 +186,8 @@ import {
|
|
|
170
186
|
sweptCircleCollision,
|
|
171
187
|
testBot,
|
|
172
188
|
tick,
|
|
189
|
+
turnToAngle,
|
|
190
|
+
turnToward,
|
|
173
191
|
updateShield,
|
|
174
192
|
useArenaSize,
|
|
175
193
|
useBlinkCooldown,
|
|
@@ -182,11 +200,14 @@ import {
|
|
|
182
200
|
useEnemy,
|
|
183
201
|
useHealth,
|
|
184
202
|
useLastHitTick,
|
|
203
|
+
useLastMissileConfig,
|
|
185
204
|
useMemo,
|
|
186
205
|
useMyProjectiles,
|
|
187
206
|
useMyThreatsToEnemy,
|
|
188
207
|
useParam,
|
|
189
208
|
usePosition,
|
|
209
|
+
useProjectiles,
|
|
210
|
+
useRandom,
|
|
190
211
|
useRef,
|
|
191
212
|
useShieldStrength,
|
|
192
213
|
useState,
|
|
@@ -197,16 +218,16 @@ import {
|
|
|
197
218
|
useVelocity,
|
|
198
219
|
validateHookCall,
|
|
199
220
|
validateMissileConfig,
|
|
200
|
-
|
|
201
|
-
|
|
221
|
+
withMissileContext,
|
|
222
|
+
withWizardContext,
|
|
202
223
|
wrapWithParams
|
|
203
|
-
} from "./chunk-
|
|
224
|
+
} from "./chunk-G5T65F3W.js";
|
|
204
225
|
export {
|
|
205
226
|
ALL_BOTS,
|
|
206
|
-
|
|
227
|
+
ARENA_MAX,
|
|
228
|
+
ARENA_MIN,
|
|
207
229
|
ARENA_SIZE,
|
|
208
230
|
ARENA_WATER_BUFFER,
|
|
209
|
-
ARENA_WIDTH,
|
|
210
231
|
Archlich,
|
|
211
232
|
Archmage,
|
|
212
233
|
BLINK_CAST_TIME,
|
|
@@ -231,6 +252,11 @@ export {
|
|
|
231
252
|
Golem,
|
|
232
253
|
Hogger,
|
|
233
254
|
Infernalist,
|
|
255
|
+
KNOCKBACK_DAMAGE_THRESHOLD,
|
|
256
|
+
KNOCKBACK_DECAY,
|
|
257
|
+
KNOCKBACK_DELAY,
|
|
258
|
+
KNOCKBACK_SPEED_PER_DAMAGE,
|
|
259
|
+
LAVA_BORDER_WIDTH,
|
|
234
260
|
Lich,
|
|
235
261
|
MATCH_DURATION,
|
|
236
262
|
MAX_HEALTH,
|
|
@@ -253,6 +279,8 @@ export {
|
|
|
253
279
|
ManualMatch,
|
|
254
280
|
Nightblade,
|
|
255
281
|
Pyromancer,
|
|
282
|
+
RULES,
|
|
283
|
+
RULESET_RANGES,
|
|
256
284
|
Rookie,
|
|
257
285
|
SHIELD_CAST_TIME,
|
|
258
286
|
SHIELD_DECAY_PER_SECOND,
|
|
@@ -290,8 +318,8 @@ export {
|
|
|
290
318
|
angleDiff,
|
|
291
319
|
angleInRange,
|
|
292
320
|
angleTo,
|
|
293
|
-
antiHomingMissile,
|
|
294
321
|
applyDamage,
|
|
322
|
+
applyRulesetOverrides,
|
|
295
323
|
blink,
|
|
296
324
|
browserSandboxFight,
|
|
297
325
|
browserSandboxSimulate,
|
|
@@ -312,18 +340,22 @@ export {
|
|
|
312
340
|
createInitialState,
|
|
313
341
|
createRandom,
|
|
314
342
|
createWorkerScript,
|
|
343
|
+
currentRuleset,
|
|
315
344
|
diagnoseTrace,
|
|
316
345
|
directionAway,
|
|
317
346
|
directionTo,
|
|
318
347
|
distanceTo,
|
|
319
348
|
effectiveTurnRateCost,
|
|
320
349
|
extractAction,
|
|
350
|
+
extractMissileAction,
|
|
321
351
|
extractStats,
|
|
322
352
|
extractTraceEvents,
|
|
323
353
|
fight,
|
|
324
354
|
findInRange,
|
|
325
355
|
findNearest,
|
|
356
|
+
fitMissileForEscapingTarget,
|
|
326
357
|
fitMissileToBudget,
|
|
358
|
+
flyStraight,
|
|
327
359
|
formatDiagnosis,
|
|
328
360
|
formatStats,
|
|
329
361
|
formatTraceEvents,
|
|
@@ -331,18 +363,21 @@ export {
|
|
|
331
363
|
generateCandidates,
|
|
332
364
|
generateCombos,
|
|
333
365
|
getAdaptiveMissileConfig,
|
|
334
|
-
getBotContext,
|
|
335
366
|
getEffectiveRange,
|
|
336
367
|
getLeadPosition,
|
|
337
368
|
getMissileCastTime,
|
|
369
|
+
getMissileContext,
|
|
338
370
|
getPlayerState,
|
|
371
|
+
getWizardContext,
|
|
339
372
|
hashCombine,
|
|
340
373
|
homingMissile,
|
|
341
374
|
idle,
|
|
342
375
|
inRange,
|
|
343
376
|
interceptAngle,
|
|
344
|
-
|
|
377
|
+
isBannedBotName,
|
|
378
|
+
isInLava,
|
|
345
379
|
magnitude,
|
|
380
|
+
matchesAnyBanRule,
|
|
346
381
|
missile,
|
|
347
382
|
move,
|
|
348
383
|
moveInDirection,
|
|
@@ -354,15 +389,17 @@ export {
|
|
|
354
389
|
normalizeAngle,
|
|
355
390
|
predictPosition,
|
|
356
391
|
resetAllHooks,
|
|
392
|
+
resetRuleset,
|
|
357
393
|
resolveWizardCollision,
|
|
358
|
-
runBotWithContext,
|
|
359
394
|
runWithHooks,
|
|
395
|
+
runWizardWithContext,
|
|
360
396
|
scoreFight,
|
|
361
397
|
scoreFightAsWizard2,
|
|
362
398
|
seekerMissile,
|
|
363
399
|
setParamValues,
|
|
364
400
|
shield,
|
|
365
401
|
simulate,
|
|
402
|
+
simulateMinDuration,
|
|
366
403
|
sortByDistance,
|
|
367
404
|
spiralMissile,
|
|
368
405
|
startCast,
|
|
@@ -373,6 +410,8 @@ export {
|
|
|
373
410
|
sweptCircleCollision,
|
|
374
411
|
testBot,
|
|
375
412
|
tick,
|
|
413
|
+
turnToAngle,
|
|
414
|
+
turnToward,
|
|
376
415
|
updateShield,
|
|
377
416
|
useArenaSize,
|
|
378
417
|
useBlinkCooldown,
|
|
@@ -385,11 +424,14 @@ export {
|
|
|
385
424
|
useEnemy,
|
|
386
425
|
useHealth,
|
|
387
426
|
useLastHitTick,
|
|
427
|
+
useLastMissileConfig,
|
|
388
428
|
useMemo,
|
|
389
429
|
useMyProjectiles,
|
|
390
430
|
useMyThreatsToEnemy,
|
|
391
431
|
useParam,
|
|
392
432
|
usePosition,
|
|
433
|
+
useProjectiles,
|
|
434
|
+
useRandom,
|
|
393
435
|
useRef,
|
|
394
436
|
useShieldStrength,
|
|
395
437
|
useState,
|
|
@@ -400,8 +442,8 @@ export {
|
|
|
400
442
|
useVelocity,
|
|
401
443
|
validateHookCall,
|
|
402
444
|
validateMissileConfig,
|
|
403
|
-
|
|
404
|
-
|
|
445
|
+
withMissileContext,
|
|
446
|
+
withWizardContext,
|
|
405
447
|
wrapWithParams
|
|
406
448
|
};
|
|
407
449
|
//# sourceMappingURL=index-browser.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FightResult, SimulateResult } from './index-browser.js';
|
|
2
|
-
export { ALL_BOTS,
|
|
2
|
+
export { ALL_BOTS, ARENA_MAX, ARENA_MIN, ARENA_SIZE, ARENA_WATER_BUFFER, ActionBuilder, AnalyzedThreat, Archlich, Archmage, BLINK_CAST_TIME, BLINK_COOLDOWN, BLINK_MAX_COOLDOWN, BLINK_MAX_RANGE, BLINK_MIN_COOLDOWN, BLINK_RANGE, BOT_GROUPS, Battlemage, BlinkEvent, Bonemancer, BotError, BrowserManualMatchSandbox, BrowserMatchSandbox, BrowserSandboxOptions, CASTING_MOVEMENT_MULT, COLLISION_RADIUS, CastCancelEvent, CastStartEvent, Critter, Doombringer, ENGINE_VERSION, EnemyState, FIGHT_SPAWN_DISTANCES, FightStats, FightWinner, FinalAction, Flamecaller, GCD_DURATION, GameConfig, GameState, Golem, Hogger, HomingParams, HookState, Infernalist, InternalWizardState, KNOCKBACK_DAMAGE_THRESHOLD, KNOCKBACK_DECAY, KNOCKBACK_DELAY, KNOCKBACK_SPEED_PER_DAMAGE, LAVA_BORDER_WIDTH, Lich, MATCH_DURATION, MAX_HEALTH, MISSILE_BASE_CAST, MISSILE_BASE_RADIUS, MISSILE_DAMAGE_POWER, MISSILE_DAMAGE_RADIUS_SCALE, MISSILE_DAMAGE_SCALE, MISSILE_HOMING_COEFF, MISSILE_MIN_CAST_TIME, MISSILE_MIN_DAMAGE, MISSILE_MIN_DURATION, MISSILE_MIN_SPEED, MISSILE_RADIUS_PER_DAMAGE, MISSILE_SPEED_DURATION_BASELINE, MISSILE_SPEED_DURATION_COEFF, MISSILE_TURN_DURATION_COEFF, MOVEMENT_SPEED, MOVE_SPEED, ManualMatch, ManualMatchInitOptions, ManualMatchOptions, ManualMatchStepRequest, MatchWinner, MissileAction, MissileActions, MissileConfig, MissileContext, MissileExpiredEvent, MissileFunction, MissileHitEvent, MissileLaunchEvent, MissileOobEvent, MissileTemplate, Nightblade, ParamDeclaration, Position, ProjectileState, Pyromancer, RULES, RULESET_RANGES, RefObject, Rookie, SHIELD_CAST_TIME, SHIELD_DECAY_PER_SECOND, SHIELD_DECAY_RATE, SHIELD_MAX_BLOCK, SHIELD_MAX_STRENGTH, SHIELD_MIN_BLOCK, SHIELD_MIN_STRENGTH, SPAWN_DISTANCE, SeekerParams, Sentinel, Shadowblade, ShieldBlockEvent, ShieldStartEvent, SimEvent, Spellbinder, Spellseeker, Spellshot, Spellspinner, Spelltracer, Spellweaver, SpiralParams, StepResult, Stormcaller, Stormchaser, Stormforger, StraightParams, TICKS_PER_SECOND, TICK_DURATION_MS, TargetDummy, TestBotBuilder, TestFightResult, TestSimulateResult, TraceBotSummary, TraceEvent, TraceEventType, TraceSummary, Turtle, Velocity, Voidblade, WARMUP_DURATION_TOLERANCE, WARMUP_MAX_BONUS, WARMUP_MAX_PENALTY, WARMUP_SPEED_TOLERANCE, WARMUP_TURN_TOLERANCE, WIZARD_HEALTH, WIZARD_RADIUS, Warmage, WizardActions, WizardContext, WizardDeathEvent, WizardEntry, WizardFunction, WizardGroup, WizardLavaDeathEvent, WizardState, WorkerFactory, WorkerLike, analyzeThreats, angleDiff, angleInRange, angleTo, applyDamage, applyRulesetOverrides, blink, browserSandboxFight, browserSandboxSimulate, calculateBlinkCooldown, calculateMissileCastTime, calculateMissileRadius, calculateMissileSimilarity, calculateShieldBlock, calculateWarmupMultiplier, cancel, cancelCast, clampPositionToArena, clampToArena, clearHooks, clearParamValues, completeCast, createEntitySeed, createInitialState, createRandom, createWorkerScript, currentRuleset, diagnoseTrace, directionAway, directionTo, distanceTo, effectiveTurnRateCost, extractAction, extractMissileAction, extractStats, extractTraceEvents, fight, findInRange, findNearest, fitMissileForEscapingTarget, fitMissileToBudget, flyStraight, formatDiagnosis, formatStats, formatTraceEvents, formatTraceSummary, generateCandidates, generateCombos, getAdaptiveMissileConfig, getEffectiveRange, getLeadPosition, getMissileCastTime, getMissileContext, getPlayerState, getWizardContext, hashCombine, homingMissile, idle, inRange, interceptAngle, isBannedBotName, isInLava, magnitude, matchesAnyBanRule, missile, move, moveInDirection, moveProjectile, moveWizard, narrowRange, nextRandom, normalize, normalizeAngle, predictPosition, resetAllHooks, resetRuleset, resolveWizardCollision, runWithHooks, runWizardWithContext, scoreFight, scoreFightAsWizard2, seekerMissile, setParamValues, shield, simulate, simulateMinDuration, sortByDistance, spiralMissile, startCast, startDiscovery, stopDiscovery, straightMissile, summarizeTrace, sweptCircleCollision, testBot, tick, turnToAngle, turnToward, updateShield, useArenaSize, useBlinkCooldown, useCastProgress, useCastingSpell, useClosestThreat, useDamageDealt, useDamageTaken, useEffect, useEnemy, useHealth, useLastHitTick, useLastMissileConfig, useMemo, useMyProjectiles, useMyThreatsToEnemy, useParam, usePosition, useProjectiles, useRandom, useRef, useShieldStrength, useState, useStatus, useThreats, useTick, useTicksUntilReady, useVelocity, validateHookCall, validateMissileConfig, withMissileContext, withWizardContext, wrapWithParams } from './index-browser.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* A compiled bot ready for sandboxed execution.
|
|
@@ -54,7 +54,7 @@ declare function compileMatchBundle(bot1: BotBundle, bot2: BotBundle, options?:
|
|
|
54
54
|
interface SandboxOptions {
|
|
55
55
|
/** Memory limit in MB for the isolate (default: 512). */
|
|
56
56
|
memoryLimitMB?: number;
|
|
57
|
-
/** Timeout in ms for fight/simulate calls (default:
|
|
57
|
+
/** Timeout in ms for fight/simulate calls (default: 60000). */
|
|
58
58
|
timeoutMs?: number;
|
|
59
59
|
/** Options passed to esbuild compilation (aliases, externals). */
|
|
60
60
|
compileOptions?: CompileOptions;
|
|
@@ -147,4 +147,54 @@ declare function sandboxSimulate(bot1: BotBundle, bot2: BotBundle, options?: {
|
|
|
147
147
|
params2?: Record<string, number>;
|
|
148
148
|
} & SandboxOptions): Promise<SimulateResult>;
|
|
149
149
|
|
|
150
|
-
|
|
150
|
+
/**
|
|
151
|
+
* Run a fight between two PRECOMPILED bot bundles — the canonical uploaded-wizard
|
|
152
|
+
* format where each IIFE sets `globalThis.__injectedBot1` (see compileSingleBotBundle).
|
|
153
|
+
*
|
|
154
|
+
* Shared by the Cloud Functions matchmaker and the devkit CLI so that a
|
|
155
|
+
* `handle/botname` fight runs through the exact same engine as the live ladder.
|
|
156
|
+
*
|
|
157
|
+
* Both bundles run inside an isolated-vm isolate alongside a "match template" —
|
|
158
|
+
* the engine + a `__fight` harness that reads the injected bots. The template is
|
|
159
|
+
* built lazily from the engine source on first use and cached; callers that
|
|
160
|
+
* already have one (the Cloud Functions committed MATCH_TEMPLATE) pass it in to
|
|
161
|
+
* skip the esbuild step.
|
|
162
|
+
*
|
|
163
|
+
* Execution order inside the isolate: bot1 bundle → bot2 bundle → match template.
|
|
164
|
+
*/
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Build (and cache) the match template: the engine + `__fight`/`__simulate`
|
|
168
|
+
* harness bundled into a single IIFE string, ready to run after two bot bundles
|
|
169
|
+
* have set `globalThis.__injectedBot1`/`__injectedBot2`.
|
|
170
|
+
*/
|
|
171
|
+
declare function buildMatchTemplate(): Promise<string>;
|
|
172
|
+
interface RunBundleFightOptions {
|
|
173
|
+
seed: number;
|
|
174
|
+
/** Prebuilt match template (e.g. the committed Cloud Functions one). Built lazily if omitted. */
|
|
175
|
+
matchTemplate?: string;
|
|
176
|
+
/** Skip per-tick history in the result (smaller copy out of the isolate). Default true. */
|
|
177
|
+
skipHistory?: boolean;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Run a fight between two compiled `__injectedBot1`-format bundles.
|
|
181
|
+
*
|
|
182
|
+
* bundle1 is saved and its global cleared before bundle2 runs, so bot code can
|
|
183
|
+
* never read the opponent's function off globalThis. Both globals are deleted
|
|
184
|
+
* after wiring so runtime bot code can't reach them either.
|
|
185
|
+
*/
|
|
186
|
+
declare function runBundleFight(bundle1: string, bundle2: string, options: RunBundleFightOptions): Promise<FightResult>;
|
|
187
|
+
interface RunBundleSimulateOptions {
|
|
188
|
+
seed?: number;
|
|
189
|
+
spawnDistance?: number;
|
|
190
|
+
maxTicks?: number;
|
|
191
|
+
matchTemplate?: string;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Run a SINGLE match between two compiled bundles, returning the full per-tick
|
|
195
|
+
* history (for tracing/debugging). Same isolate wiring as runBundleFight, but
|
|
196
|
+
* calls the template's `__simulate` so the caller gets a SimulateResult.
|
|
197
|
+
*/
|
|
198
|
+
declare function runBundleSimulate(bundle1: string, bundle2: string, options?: RunBundleSimulateOptions): Promise<SimulateResult>;
|
|
199
|
+
|
|
200
|
+
export { BotBundle, type CompileOptions, FightResult, MatchSandbox, type RunBundleFightOptions, type RunBundleSimulateOptions, type SandboxOptions, SimulateResult, buildMatchTemplate, compileMatchBundle, runBundleFight, runBundleSimulate, sandboxFight, sandboxSimulate };
|