@vibemancer/core 0.1.0 → 0.1.1
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 +28 -28
- package/dist/{chunk-L7Z7OFXD.js → chunk-7VDJHO22.js} +3 -3
- package/dist/chunk-7VDJHO22.js.map +1 -0
- package/dist/index-browser.d.ts +1 -1
- package/dist/index-browser.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +79 -78
- package/src/bots/berserker/01_Stormchaser.ts +457 -457
- package/src/bots/berserker/02_Stormcaller.ts +417 -417
- package/src/bots/berserker/03_Stormforger.ts +481 -481
- package/src/bots/caster/01_Flamecaller.ts +286 -286
- package/src/bots/caster/02_Pyromancer.ts +350 -350
- package/src/bots/caster/03_Infernalist.ts +492 -492
- package/src/bots/defensive/01_Turtle.ts +151 -151
- package/src/bots/defensive/02_Sentinel.ts +134 -134
- package/src/bots/defensive/03_Golem.ts +357 -357
- package/src/bots/duelist/01_Battlemage.ts +433 -433
- package/src/bots/duelist/02_Warmage.ts +438 -438
- package/src/bots/duelist/03_Archmage.ts +588 -588
- package/src/bots/homing/01_Bonemancer.ts +67 -67
- package/src/bots/homing/02_Lich.ts +356 -356
- package/src/bots/homing/03_Archlich.ts +220 -220
- package/src/bots/kiter/01_Spellspinner.ts +398 -398
- package/src/bots/kiter/02_Spellweaver.ts +378 -378
- package/src/bots/kiter/03_Spellbinder.ts +448 -448
- package/src/bots/melee/01_Shadowblade.ts +270 -270
- package/src/bots/melee/02_Nightblade.ts +437 -437
- package/src/bots/melee/03_Voidblade.ts +582 -582
- package/src/bots/sniper/01_Spellshot.ts +385 -385
- package/src/bots/sniper/02_Spelltracer.ts +441 -441
- package/src/bots/sniper/03_Spellseeker.ts +546 -546
- package/src/bots/standalone/Critter.ts +89 -89
- package/src/bots/standalone/Doombringer.ts +91 -91
- package/src/bots/standalone/Hogger.ts +228 -228
- package/src/bots/standalone/Rookie.ts +50 -50
- package/src/bots/standalone/TargetDummy.ts +21 -21
- package/src/bots/test/cheater.ts +405 -405
- package/src/bots/test/crasher.ts +81 -81
- package/src/engine/hooks-runtime.ts +394 -394
- package/src/engine/manual-match.ts +289 -289
- package/src/engine/missile-templates.ts +155 -155
- package/src/engine/physics.ts +143 -143
- package/src/engine/simulation.ts +828 -828
- package/src/engine/spells.ts +128 -128
- package/src/engine-version.ts +1 -1
- package/src/index.ts +23 -23
- package/src/rules.ts +254 -254
- package/src/types.ts +193 -193
- package/src/utils/index.ts +6 -6
- package/dist/chunk-L7Z7OFXD.js.map +0 -1
package/src/bots/test/crasher.ts
CHANGED
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CRASHER TEST BOTS
|
|
3
|
-
*
|
|
4
|
-
* These bots attempt various DoS attacks to test sandbox safety.
|
|
5
|
-
* They are NOT registered in ALL_BOTS — test-only.
|
|
6
|
-
*
|
|
7
|
-
* Each variant targets a different attack vector:
|
|
8
|
-
* - CrasherInfiniteLoop: CPU exhaustion via while(true)
|
|
9
|
-
* - CrasherMemoryBomb: memory exhaustion via allocation
|
|
10
|
-
* - CrasherStackOverflow: stack exhaustion via recursion
|
|
11
|
-
* - CrasherMissileLoop: infinite loop inside missile AI
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
import type {MissileActions, WizardFunction} from '../../types.js';
|
|
15
|
-
import {angleTo} from '../../utils/angles.js';
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Enters an infinite loop immediately. Tests CPU timeout enforcement.
|
|
19
|
-
*/
|
|
20
|
-
export const CrasherInfiniteLoop: WizardFunction = () =>
|
|
21
|
-
{
|
|
22
|
-
while (true)
|
|
23
|
-
{
|
|
24
|
-
// Spin forever — should be killed by isolate timeout
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Allocates memory until the isolate runs out. Tests memory limit enforcement.
|
|
30
|
-
*/
|
|
31
|
-
export const CrasherMemoryBomb: WizardFunction = () =>
|
|
32
|
-
{
|
|
33
|
-
const bomb: number[][] = [];
|
|
34
|
-
while (true)
|
|
35
|
-
{
|
|
36
|
-
bomb.push(new Array(1_000_000).fill(42));
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Recurses until stack overflow. Tests stack exhaustion handling.
|
|
42
|
-
*/
|
|
43
|
-
export const CrasherStackOverflow: WizardFunction = () =>
|
|
44
|
-
{
|
|
45
|
-
function recurse(): number
|
|
46
|
-
{
|
|
47
|
-
return 1 + recurse();
|
|
48
|
-
}
|
|
49
|
-
recurse();
|
|
50
|
-
return {move: {x: 0, y: 0}};
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Returns a valid wizard action but with a missile AI that loops forever.
|
|
55
|
-
* Tests that missile AI infinite loops are caught by the sandbox timeout.
|
|
56
|
-
*
|
|
57
|
-
* Note: in the shared-isolate architecture, missile AIs run inside the same
|
|
58
|
-
* isolate as part of simulate(). An infinite loop in missile AI will cause
|
|
59
|
-
* the entire fight to timeout.
|
|
60
|
-
*/
|
|
61
|
-
export const CrasherMissileLoop: WizardFunction = ({state}) =>
|
|
62
|
-
{
|
|
63
|
-
const enemy = state.enemies[0];
|
|
64
|
-
if (!enemy) return {move: {x: 0, y: 0}};
|
|
65
|
-
|
|
66
|
-
return {
|
|
67
|
-
move: {x: 0, y: 0},
|
|
68
|
-
startCast: {
|
|
69
|
-
spell: 'missile',
|
|
70
|
-
config: {damage: 10, speed: 5, turnRate: 1, duration: 100},
|
|
71
|
-
missileAI: (): MissileActions =>
|
|
72
|
-
{
|
|
73
|
-
while (true)
|
|
74
|
-
{
|
|
75
|
-
// Spin forever inside missile AI
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
direction: angleTo(state.position, enemy.position),
|
|
79
|
-
},
|
|
80
|
-
};
|
|
81
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* CRASHER TEST BOTS
|
|
3
|
+
*
|
|
4
|
+
* These bots attempt various DoS attacks to test sandbox safety.
|
|
5
|
+
* They are NOT registered in ALL_BOTS — test-only.
|
|
6
|
+
*
|
|
7
|
+
* Each variant targets a different attack vector:
|
|
8
|
+
* - CrasherInfiniteLoop: CPU exhaustion via while(true)
|
|
9
|
+
* - CrasherMemoryBomb: memory exhaustion via allocation
|
|
10
|
+
* - CrasherStackOverflow: stack exhaustion via recursion
|
|
11
|
+
* - CrasherMissileLoop: infinite loop inside missile AI
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import type {MissileActions, WizardFunction} from '../../types.js';
|
|
15
|
+
import {angleTo} from '../../utils/angles.js';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Enters an infinite loop immediately. Tests CPU timeout enforcement.
|
|
19
|
+
*/
|
|
20
|
+
export const CrasherInfiniteLoop: WizardFunction = (_props) =>
|
|
21
|
+
{
|
|
22
|
+
while (true)
|
|
23
|
+
{
|
|
24
|
+
// Spin forever — should be killed by isolate timeout
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Allocates memory until the isolate runs out. Tests memory limit enforcement.
|
|
30
|
+
*/
|
|
31
|
+
export const CrasherMemoryBomb: WizardFunction = (_props) =>
|
|
32
|
+
{
|
|
33
|
+
const bomb: number[][] = [];
|
|
34
|
+
while (true)
|
|
35
|
+
{
|
|
36
|
+
bomb.push(new Array(1_000_000).fill(42));
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Recurses until stack overflow. Tests stack exhaustion handling.
|
|
42
|
+
*/
|
|
43
|
+
export const CrasherStackOverflow: WizardFunction = (_props) =>
|
|
44
|
+
{
|
|
45
|
+
function recurse(): number
|
|
46
|
+
{
|
|
47
|
+
return 1 + recurse();
|
|
48
|
+
}
|
|
49
|
+
recurse();
|
|
50
|
+
return {move: {x: 0, y: 0}};
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Returns a valid wizard action but with a missile AI that loops forever.
|
|
55
|
+
* Tests that missile AI infinite loops are caught by the sandbox timeout.
|
|
56
|
+
*
|
|
57
|
+
* Note: in the shared-isolate architecture, missile AIs run inside the same
|
|
58
|
+
* isolate as part of simulate(). An infinite loop in missile AI will cause
|
|
59
|
+
* the entire fight to timeout.
|
|
60
|
+
*/
|
|
61
|
+
export const CrasherMissileLoop: WizardFunction = ({state}) =>
|
|
62
|
+
{
|
|
63
|
+
const enemy = state.enemies[0];
|
|
64
|
+
if (!enemy) return {move: {x: 0, y: 0}};
|
|
65
|
+
|
|
66
|
+
return {
|
|
67
|
+
move: {x: 0, y: 0},
|
|
68
|
+
startCast: {
|
|
69
|
+
spell: 'missile',
|
|
70
|
+
config: {damage: 10, speed: 5, turnRate: 1, duration: 100},
|
|
71
|
+
missileAI: (): MissileActions =>
|
|
72
|
+
{
|
|
73
|
+
while (true)
|
|
74
|
+
{
|
|
75
|
+
// Spin forever inside missile AI
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
direction: angleTo(state.position, enemy.position),
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
};
|