redscript-mc 3.0.1 → 3.0.2
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/.github/workflows/ci.yml +1 -0
- package/README.md +119 -313
- package/README.zh.md +118 -314
- package/ROADMAP.md +5 -5
- package/dist/data/impl_test/function/counter/get.mcfunction +5 -0
- package/dist/data/impl_test/function/counter/inc.mcfunction +7 -0
- package/dist/data/impl_test/function/counter/new.mcfunction +4 -0
- package/dist/data/impl_test/function/load.mcfunction +1 -0
- package/dist/data/impl_test/function/test_impl.mcfunction +10 -0
- package/dist/data/minecraft/tags/function/load.json +5 -0
- package/dist/data/playground/function/load.mcfunction +1 -0
- package/dist/data/playground/function/start.mcfunction +4 -0
- package/dist/data/playground/function/start__say_macro_t1.mcfunction +1 -0
- package/dist/data/playground/function/stop.mcfunction +5 -0
- package/dist/data/playground/function/stop__say_macro_t0.mcfunction +1 -0
- package/dist/data/stdlib_queue8_test/function/__queue_append_apply.mcfunction +4 -0
- package/dist/data/stdlib_queue8_test/function/__queue_peek_apply.mcfunction +4 -0
- package/dist/data/stdlib_queue8_test/function/__queue_size_raw_apply.mcfunction +4 -0
- package/dist/data/stdlib_queue8_test/function/load.mcfunction +1 -0
- package/dist/data/stdlib_queue8_test/function/queue_clear.mcfunction +6 -0
- package/dist/data/stdlib_queue8_test/function/queue_empty__merge_1.mcfunction +5 -0
- package/dist/data/stdlib_queue8_test/function/queue_empty__then_0.mcfunction +5 -0
- package/dist/data/stdlib_queue8_test/function/queue_peek__merge_1.mcfunction +13 -0
- package/dist/data/stdlib_queue8_test/function/queue_peek__then_0.mcfunction +5 -0
- package/dist/data/stdlib_queue8_test/function/queue_pop__merge_1.mcfunction +15 -0
- package/dist/data/stdlib_queue8_test/function/queue_pop__then_0.mcfunction +5 -0
- package/dist/data/stdlib_queue8_test/function/queue_push__const_11.mcfunction +6 -0
- package/dist/data/stdlib_queue8_test/function/queue_push__const_22.mcfunction +6 -0
- package/dist/data/stdlib_queue8_test/function/queue_size.mcfunction +13 -0
- package/dist/data/stdlib_queue8_test/function/test_queue_push_and_size.mcfunction +13 -0
- package/dist/data/test/function/load.mcfunction +1 -0
- package/dist/data/test/function/say_at.mcfunction +6 -0
- package/dist/data/test/function/test.mcfunction +4 -0
- package/dist/pack.mcmeta +6 -0
- package/dist/package.json +1 -1
- package/dist/src/__tests__/formatter-extra.test.d.ts +7 -0
- package/dist/src/__tests__/formatter-extra.test.js +123 -0
- package/dist/src/__tests__/global-vars.test.d.ts +13 -0
- package/dist/src/__tests__/global-vars.test.js +156 -0
- package/dist/src/__tests__/lint/new-rules.test.d.ts +9 -0
- package/dist/src/__tests__/lint/new-rules.test.js +402 -0
- package/dist/src/__tests__/lsp-rename.test.d.ts +8 -0
- package/dist/src/__tests__/lsp-rename.test.js +157 -0
- package/dist/src/__tests__/mc-integration/say-fstring.test.d.ts +11 -0
- package/dist/src/__tests__/mc-integration/say-fstring.test.js +220 -0
- package/dist/src/__tests__/mc-integration/stdlib-coverage-2.test.js +1 -1
- package/dist/src/__tests__/mc-integration/stdlib-coverage-3.test.js +1 -1
- package/dist/src/__tests__/mc-integration/stdlib-coverage-4.test.js +1 -1
- package/dist/src/__tests__/mc-integration/stdlib-coverage-5.test.js +1 -1
- package/dist/src/__tests__/mc-integration/stdlib-coverage-6.test.js +1 -1
- package/dist/src/__tests__/mc-integration/stdlib-coverage-7.test.js +1 -1
- package/dist/src/__tests__/mc-integration/stdlib-coverage-8.test.js +1 -1
- package/dist/src/__tests__/mc-syntax.test.js +4 -1
- package/dist/src/__tests__/monomorphize-coverage.test.d.ts +9 -0
- package/dist/src/__tests__/monomorphize-coverage.test.js +204 -0
- package/dist/src/__tests__/optimizer-cse.test.d.ts +7 -0
- package/dist/src/__tests__/optimizer-cse.test.js +226 -0
- package/dist/src/__tests__/parser.test.js +4 -13
- package/dist/src/__tests__/repl-server-extra.test.js +6 -7
- package/dist/src/__tests__/repl-server.test.js +5 -7
- package/dist/src/__tests__/stdlib/queue.test.js +6 -6
- package/dist/src/cli.js +0 -0
- package/dist/src/lexer/index.js +2 -1
- package/dist/src/lint/index.d.ts +12 -5
- package/dist/src/lint/index.js +730 -5
- package/dist/src/lsp/main.js +0 -0
- package/dist/src/mc-test/client.d.ts +21 -0
- package/dist/src/mc-test/client.js +34 -0
- package/dist/src/mir/lower.js +108 -6
- package/dist/src/optimizer/interprocedural.js +37 -2
- package/dist/src/parser/decl-parser.d.ts +19 -0
- package/dist/src/parser/decl-parser.js +323 -0
- package/dist/src/parser/expr-parser.d.ts +46 -0
- package/dist/src/parser/expr-parser.js +759 -0
- package/dist/src/parser/index.d.ts +8 -129
- package/dist/src/parser/index.js +13 -2262
- package/dist/src/parser/stmt-parser.d.ts +28 -0
- package/dist/src/parser/stmt-parser.js +577 -0
- package/dist/src/parser/type-parser.d.ts +20 -0
- package/dist/src/parser/type-parser.js +257 -0
- package/dist/src/parser/utils.d.ts +34 -0
- package/dist/src/parser/utils.js +141 -0
- package/docs/dev/README-mc-integration-tests.md +141 -0
- package/docs/lint-rules.md +162 -0
- package/docs/stdlib/bigint.md +2 -0
- package/editors/vscode/README.md +63 -41
- package/editors/vscode/out/extension.js +1881 -1776
- package/editors/vscode/out/lsp-server.js +4257 -3651
- package/editors/vscode/package-lock.json +3 -3
- package/editors/vscode/package.json +1 -1
- package/examples/loops-demo.mcrs +87 -0
- package/package.json +1 -1
- package/redscript-docs/docs/en/stdlib/advanced.md +629 -0
- package/redscript-docs/docs/en/stdlib/bigint.md +316 -0
- package/redscript-docs/docs/en/stdlib/bits.md +292 -0
- package/redscript-docs/docs/en/stdlib/bossbar.md +177 -0
- package/redscript-docs/docs/en/stdlib/calculus.md +289 -0
- package/redscript-docs/docs/en/stdlib/color.md +353 -0
- package/redscript-docs/docs/en/stdlib/combat.md +88 -0
- package/redscript-docs/docs/en/stdlib/cooldown.md +82 -0
- package/redscript-docs/docs/en/stdlib/dialog.md +155 -0
- package/redscript-docs/docs/en/stdlib/easing.md +558 -0
- package/redscript-docs/docs/en/stdlib/ecs.md +475 -0
- package/redscript-docs/docs/en/stdlib/effects.md +324 -0
- package/redscript-docs/docs/en/stdlib/events.md +3 -0
- package/redscript-docs/docs/en/stdlib/expr.md +45 -0
- package/redscript-docs/docs/en/stdlib/fft.md +141 -0
- package/redscript-docs/docs/en/stdlib/geometry.md +430 -0
- package/redscript-docs/docs/en/stdlib/graph.md +259 -0
- package/redscript-docs/docs/en/stdlib/heap.md +185 -0
- package/redscript-docs/docs/en/stdlib/interactions.md +179 -0
- package/redscript-docs/docs/en/stdlib/inventory.md +97 -0
- package/redscript-docs/docs/en/stdlib/linalg.md +557 -0
- package/redscript-docs/docs/en/stdlib/list.md +559 -0
- package/redscript-docs/docs/en/stdlib/map.md +140 -0
- package/redscript-docs/docs/en/stdlib/math.md +193 -0
- package/redscript-docs/docs/en/stdlib/math_hp.md +149 -0
- package/redscript-docs/docs/en/stdlib/matrix.md +403 -0
- package/redscript-docs/docs/en/stdlib/mobs.md +965 -0
- package/redscript-docs/docs/en/stdlib/noise.md +244 -0
- package/redscript-docs/docs/en/stdlib/ode.md +253 -0
- package/redscript-docs/docs/en/stdlib/parabola.md +342 -0
- package/redscript-docs/docs/en/stdlib/particles.md +311 -0
- package/redscript-docs/docs/en/stdlib/pathfind.md +255 -0
- package/redscript-docs/docs/en/stdlib/physics.md +493 -0
- package/redscript-docs/docs/en/stdlib/player.md +78 -0
- package/redscript-docs/docs/en/stdlib/quaternion.md +673 -0
- package/redscript-docs/docs/en/stdlib/queue.md +134 -0
- package/redscript-docs/docs/en/stdlib/random.md +223 -0
- package/redscript-docs/docs/en/stdlib/result.md +143 -0
- package/redscript-docs/docs/en/stdlib/scheduler.md +183 -0
- package/redscript-docs/docs/en/stdlib/set_int.md +190 -0
- package/redscript-docs/docs/en/stdlib/sets.md +101 -0
- package/redscript-docs/docs/en/stdlib/signal.md +400 -0
- package/redscript-docs/docs/en/stdlib/sort.md +104 -0
- package/redscript-docs/docs/en/stdlib/spawn.md +147 -0
- package/redscript-docs/docs/en/stdlib/state.md +142 -0
- package/redscript-docs/docs/en/stdlib/strings.md +154 -0
- package/redscript-docs/docs/en/stdlib/tags.md +3451 -0
- package/redscript-docs/docs/en/stdlib/teams.md +153 -0
- package/redscript-docs/docs/en/stdlib/timer.md +246 -0
- package/redscript-docs/docs/en/stdlib/vec.md +158 -0
- package/redscript-docs/docs/en/stdlib/world.md +298 -0
- package/redscript-docs/docs/zh/stdlib/advanced.md +615 -0
- package/redscript-docs/docs/zh/stdlib/bigint.md +316 -0
- package/redscript-docs/docs/zh/stdlib/bits.md +292 -0
- package/redscript-docs/docs/zh/stdlib/bossbar.md +170 -0
- package/redscript-docs/docs/zh/stdlib/calculus.md +287 -0
- package/redscript-docs/docs/zh/stdlib/color.md +353 -0
- package/redscript-docs/docs/zh/stdlib/combat.md +88 -0
- package/redscript-docs/docs/zh/stdlib/cooldown.md +84 -0
- package/redscript-docs/docs/zh/stdlib/dialog.md +152 -0
- package/redscript-docs/docs/zh/stdlib/easing.md +558 -0
- package/redscript-docs/docs/zh/stdlib/ecs.md +472 -0
- package/redscript-docs/docs/zh/stdlib/effects.md +324 -0
- package/redscript-docs/docs/zh/stdlib/events.md +3 -0
- package/redscript-docs/docs/zh/stdlib/expr.md +37 -0
- package/redscript-docs/docs/zh/stdlib/fft.md +128 -0
- package/redscript-docs/docs/zh/stdlib/geometry.md +430 -0
- package/redscript-docs/docs/zh/stdlib/graph.md +259 -0
- package/redscript-docs/docs/zh/stdlib/heap.md +185 -0
- package/redscript-docs/docs/zh/stdlib/interactions.md +160 -0
- package/redscript-docs/docs/zh/stdlib/inventory.md +94 -0
- package/redscript-docs/docs/zh/stdlib/linalg.md +543 -0
- package/redscript-docs/docs/zh/stdlib/list.md +561 -0
- package/redscript-docs/docs/zh/stdlib/map.md +132 -0
- package/redscript-docs/docs/zh/stdlib/math.md +193 -0
- package/redscript-docs/docs/zh/stdlib/math_hp.md +143 -0
- package/redscript-docs/docs/zh/stdlib/matrix.md +396 -0
- package/redscript-docs/docs/zh/stdlib/mobs.md +965 -0
- package/redscript-docs/docs/zh/stdlib/noise.md +244 -0
- package/redscript-docs/docs/zh/stdlib/ode.md +243 -0
- package/redscript-docs/docs/zh/stdlib/parabola.md +337 -0
- package/redscript-docs/docs/zh/stdlib/particles.md +307 -0
- package/redscript-docs/docs/zh/stdlib/pathfind.md +255 -0
- package/redscript-docs/docs/zh/stdlib/physics.md +493 -0
- package/redscript-docs/docs/zh/stdlib/player.md +78 -0
- package/redscript-docs/docs/zh/stdlib/quaternion.md +669 -0
- package/redscript-docs/docs/zh/stdlib/queue.md +124 -0
- package/redscript-docs/docs/zh/stdlib/random.md +222 -0
- package/redscript-docs/docs/zh/stdlib/result.md +147 -0
- package/redscript-docs/docs/zh/stdlib/scheduler.md +173 -0
- package/redscript-docs/docs/zh/stdlib/set_int.md +180 -0
- package/redscript-docs/docs/zh/stdlib/sets.md +107 -0
- package/redscript-docs/docs/zh/stdlib/signal.md +373 -0
- package/redscript-docs/docs/zh/stdlib/sort.md +104 -0
- package/redscript-docs/docs/zh/stdlib/spawn.md +142 -0
- package/redscript-docs/docs/zh/stdlib/state.md +134 -0
- package/redscript-docs/docs/zh/stdlib/strings.md +107 -0
- package/redscript-docs/docs/zh/stdlib/tags.md +3451 -0
- package/redscript-docs/docs/zh/stdlib/teams.md +150 -0
- package/redscript-docs/docs/zh/stdlib/timer.md +254 -0
- package/redscript-docs/docs/zh/stdlib/vec.md +158 -0
- package/redscript-docs/docs/zh/stdlib/world.md +289 -0
- package/src/__tests__/formatter-extra.test.ts +139 -0
- package/src/__tests__/global-vars.test.ts +171 -0
- package/src/__tests__/lint/new-rules.test.ts +437 -0
- package/src/__tests__/lsp-rename.test.ts +171 -0
- package/src/__tests__/mc-integration/say-fstring.test.ts +211 -0
- package/src/__tests__/mc-integration/stdlib-coverage-2.test.ts +1 -1
- package/src/__tests__/mc-integration/stdlib-coverage-3.test.ts +1 -1
- package/src/__tests__/mc-integration/stdlib-coverage-4.test.ts +1 -1
- package/src/__tests__/mc-integration/stdlib-coverage-5.test.ts +1 -1
- package/src/__tests__/mc-integration/stdlib-coverage-6.test.ts +1 -1
- package/src/__tests__/mc-integration/stdlib-coverage-7.test.ts +1 -1
- package/src/__tests__/mc-integration/stdlib-coverage-8.test.ts +1 -1
- package/src/__tests__/mc-syntax.test.ts +3 -0
- package/src/__tests__/monomorphize-coverage.test.ts +220 -0
- package/src/__tests__/optimizer-cse.test.ts +250 -0
- package/src/__tests__/parser.test.ts +4 -13
- package/src/__tests__/repl-server-extra.test.ts +6 -6
- package/src/__tests__/repl-server.test.ts +5 -6
- package/src/__tests__/stdlib/queue.test.ts +6 -6
- package/src/lexer/index.ts +2 -1
- package/src/lint/index.ts +713 -5
- package/src/mc-test/client.ts +40 -0
- package/src/mir/lower.ts +111 -2
- package/src/optimizer/interprocedural.ts +40 -2
- package/src/parser/decl-parser.ts +349 -0
- package/src/parser/expr-parser.ts +838 -0
- package/src/parser/index.ts +17 -2558
- package/src/parser/stmt-parser.ts +585 -0
- package/src/parser/type-parser.ts +276 -0
- package/src/parser/utils.ts +173 -0
- package/src/stdlib/queue.mcrs +19 -6
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
# Geometry
|
|
2
|
+
|
|
3
|
+
> Auto-generated from `src/stdlib/geometry.mcrs` — do not edit manually.
|
|
4
|
+
|
|
5
|
+
## API
|
|
6
|
+
|
|
7
|
+
- [midpoint](#midpoint)
|
|
8
|
+
- [aabb_contains](#aabb-contains)
|
|
9
|
+
- [sphere_contains](#sphere-contains)
|
|
10
|
+
- [cylinder_contains](#cylinder-contains)
|
|
11
|
+
- [parabola_y](#parabola-y)
|
|
12
|
+
- [parabola_x](#parabola-x)
|
|
13
|
+
- [parabola_land_t](#parabola-land-t)
|
|
14
|
+
- [tile_of](#tile-of)
|
|
15
|
+
- [tile_center](#tile-center)
|
|
16
|
+
- [angle_normalize](#angle-normalize)
|
|
17
|
+
- [angle_diff](#angle-diff)
|
|
18
|
+
- [mc_day_angle](#mc-day-angle)
|
|
19
|
+
- [in_cylinder](#in-cylinder)
|
|
20
|
+
- [in_cone](#in-cone)
|
|
21
|
+
- [in_sector_2d](#in-sector-2d)
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## `midpoint` <Badge type="info" text="v1.0.0" />
|
|
26
|
+
|
|
27
|
+
Compute the integer midpoint of two coordinates.
|
|
28
|
+
|
|
29
|
+
```redscript
|
|
30
|
+
fn midpoint(a: int, b: int): int
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**Parameters**
|
|
34
|
+
|
|
35
|
+
| Parameter | Description |
|
|
36
|
+
|-----------|-------------|
|
|
37
|
+
| `a` | First coordinate (any unit) |
|
|
38
|
+
| `b` | Second coordinate (any unit) |
|
|
39
|
+
|
|
40
|
+
**Returns:** (a + b) / 2 (integer truncation)
|
|
41
|
+
|
|
42
|
+
**Example**
|
|
43
|
+
|
|
44
|
+
```redscript
|
|
45
|
+
let m: int = midpoint(100, 300) // result: 200
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## `aabb_contains` <Badge type="info" text="v1.0.0" />
|
|
51
|
+
|
|
52
|
+
Test whether a 3D point is inside an axis-aligned bounding box (AABB).
|
|
53
|
+
|
|
54
|
+
```redscript
|
|
55
|
+
fn aabb_contains(px: int, py: int, pz: int, minx: int, miny: int, minz: int, maxx: int, maxy: int, maxz: int): int
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**Parameters**
|
|
59
|
+
|
|
60
|
+
| Parameter | Description |
|
|
61
|
+
|-----------|-------------|
|
|
62
|
+
| `px` | Point X coordinate |
|
|
63
|
+
| `py` | Point Y coordinate |
|
|
64
|
+
| `pz` | Point Z coordinate |
|
|
65
|
+
| `minx` | AABB minimum X (inclusive) |
|
|
66
|
+
| `miny` | AABB minimum Y (inclusive) |
|
|
67
|
+
| `minz` | AABB minimum Z (inclusive) |
|
|
68
|
+
| `maxx` | AABB maximum X (inclusive) |
|
|
69
|
+
| `maxy` | AABB maximum Y (inclusive) |
|
|
70
|
+
| `maxz` | AABB maximum Z (inclusive) |
|
|
71
|
+
|
|
72
|
+
**Returns:** 1 if point is inside or on the boundary of the AABB, 0 otherwise
|
|
73
|
+
|
|
74
|
+
**Example**
|
|
75
|
+
|
|
76
|
+
```redscript
|
|
77
|
+
let inside: int = aabb_contains(50, 64, 50, 0, 60, 0, 100, 70, 100)
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## `sphere_contains` <Badge type="info" text="v1.0.0" />
|
|
83
|
+
|
|
84
|
+
Test whether a 3D point is inside a sphere (using squared distance, avoids sqrt).
|
|
85
|
+
|
|
86
|
+
```redscript
|
|
87
|
+
fn sphere_contains(px: int, py: int, pz: int, cx: int, cy: int, cz: int, r: int): int
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Parameters**
|
|
91
|
+
|
|
92
|
+
| Parameter | Description |
|
|
93
|
+
|-----------|-------------|
|
|
94
|
+
| `px` | Point X |
|
|
95
|
+
| `py` | Point Y |
|
|
96
|
+
| `pz` | Point Z |
|
|
97
|
+
| `cx` | Sphere center X |
|
|
98
|
+
| `cy` | Sphere center Y |
|
|
99
|
+
| `cz` | Sphere center Z |
|
|
100
|
+
| `r` | Sphere radius (same unit as coordinates) |
|
|
101
|
+
|
|
102
|
+
**Returns:** 1 if point is within the sphere, 0 otherwise
|
|
103
|
+
|
|
104
|
+
**Example**
|
|
105
|
+
|
|
106
|
+
```redscript
|
|
107
|
+
let hit: int = sphere_contains(10, 64, 10, 0, 64, 0, 15)
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## `cylinder_contains` <Badge type="info" text="v1.0.0" />
|
|
113
|
+
|
|
114
|
+
Test whether a 2D point (XZ plane) is inside a vertical cylinder (ignores Y).
|
|
115
|
+
|
|
116
|
+
```redscript
|
|
117
|
+
fn cylinder_contains(px: int, pz: int, cx: int, cz: int, r: int): int
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
**Parameters**
|
|
121
|
+
|
|
122
|
+
| Parameter | Description |
|
|
123
|
+
|-----------|-------------|
|
|
124
|
+
| `px` | Point X |
|
|
125
|
+
| `pz` | Point Z |
|
|
126
|
+
| `cx` | Cylinder center X |
|
|
127
|
+
| `cz` | Cylinder center Z |
|
|
128
|
+
| `r` | Cylinder radius |
|
|
129
|
+
|
|
130
|
+
**Returns:** 1 if (px, pz) is within the cylinder's cross-section, 0 otherwise
|
|
131
|
+
|
|
132
|
+
**Example**
|
|
133
|
+
|
|
134
|
+
```redscript
|
|
135
|
+
let in_zone: int = cylinder_contains(5, 5, 0, 0, 8)
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## `parabola_y` <Badge type="info" text="v1.0.0" />
|
|
141
|
+
|
|
142
|
+
Compute Y position of a projectile along a parabolic arc at tick t.
|
|
143
|
+
|
|
144
|
+
```redscript
|
|
145
|
+
fn parabola_y(y0: int, vy0: int, t: int): int
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
**Parameters**
|
|
149
|
+
|
|
150
|
+
| Parameter | Description |
|
|
151
|
+
|-----------|-------------|
|
|
152
|
+
| `y0` | Initial Y ×100 |
|
|
153
|
+
| `vy0` | Initial Y velocity ×100 (blocks/tick × 100) |
|
|
154
|
+
| `t` | Tick index |
|
|
155
|
+
|
|
156
|
+
**Returns:** y0 + vy0*t - 5*t²/2 (gravity = 5 units/tick² = 0.05 blocks/tick²×100)
|
|
157
|
+
|
|
158
|
+
**Example**
|
|
159
|
+
|
|
160
|
+
```redscript
|
|
161
|
+
let y: int = parabola_y(6400, 100, 10) // at tick 10, v0=1 block/tick
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## `parabola_x` <Badge type="info" text="v1.0.0" />
|
|
167
|
+
|
|
168
|
+
Compute horizontal X position along a parabolic path (constant velocity).
|
|
169
|
+
|
|
170
|
+
```redscript
|
|
171
|
+
fn parabola_x(x0: int, vx0: int, t: int): int
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
**Parameters**
|
|
175
|
+
|
|
176
|
+
| Parameter | Description |
|
|
177
|
+
|-----------|-------------|
|
|
178
|
+
| `x0` | Initial X ×100 |
|
|
179
|
+
| `vx0` | Horizontal X velocity ×100 |
|
|
180
|
+
| `t` | Tick index |
|
|
181
|
+
|
|
182
|
+
**Returns:** x0 + vx0*t
|
|
183
|
+
|
|
184
|
+
**Example**
|
|
185
|
+
|
|
186
|
+
```redscript
|
|
187
|
+
let x: int = parabola_x(0, 50, 10) // 0 + 50*10 = 500
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## `parabola_land_t` <Badge type="info" text="v1.0.0" />
|
|
193
|
+
|
|
194
|
+
Estimate the tick when a projectile launched upward returns to Y=0.
|
|
195
|
+
|
|
196
|
+
```redscript
|
|
197
|
+
fn parabola_land_t(vy0: int): int
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
**Parameters**
|
|
201
|
+
|
|
202
|
+
| Parameter | Description |
|
|
203
|
+
|-----------|-------------|
|
|
204
|
+
| `vy0` | Initial upward Y velocity ×100 |
|
|
205
|
+
|
|
206
|
+
**Returns:** Approximate landing tick: 2 * vy0 / 5
|
|
207
|
+
|
|
208
|
+
**Example**
|
|
209
|
+
|
|
210
|
+
```redscript
|
|
211
|
+
let land: int = parabola_land_t(100) // tick when projectile lands
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## `tile_of` <Badge type="info" text="v1.0.0" />
|
|
217
|
+
|
|
218
|
+
Compute which tile a coordinate falls in (floor division, handles negatives).
|
|
219
|
+
|
|
220
|
+
```redscript
|
|
221
|
+
fn tile_of(coord: int, tile_size: int): int
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
**Parameters**
|
|
225
|
+
|
|
226
|
+
| Parameter | Description |
|
|
227
|
+
|-----------|-------------|
|
|
228
|
+
| `coord` | Coordinate value (any unit) |
|
|
229
|
+
| `tile_size` | Size of each tile in the same unit |
|
|
230
|
+
|
|
231
|
+
**Returns:** Floor-divided tile index (correct for negative coordinates)
|
|
232
|
+
|
|
233
|
+
**Example**
|
|
234
|
+
|
|
235
|
+
```redscript
|
|
236
|
+
let tile: int = tile_of(250, 100) // result: 2 (tile index 2)
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
## `tile_center` <Badge type="info" text="v1.0.0" />
|
|
242
|
+
|
|
243
|
+
Compute the center coordinate of a tile.
|
|
244
|
+
|
|
245
|
+
```redscript
|
|
246
|
+
fn tile_center(tile: int, tile_size: int): int
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
**Parameters**
|
|
250
|
+
|
|
251
|
+
| Parameter | Description |
|
|
252
|
+
|-----------|-------------|
|
|
253
|
+
| `tile` | Tile index |
|
|
254
|
+
| `tile_size` | Size of each tile |
|
|
255
|
+
|
|
256
|
+
**Returns:** tile * tile_size + tile_size / 2
|
|
257
|
+
|
|
258
|
+
**Example**
|
|
259
|
+
|
|
260
|
+
```redscript
|
|
261
|
+
let c: int = tile_center(2, 100) // result: 250 (center of tile 2)
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
---
|
|
265
|
+
|
|
266
|
+
## `angle_normalize` <Badge type="info" text="v1.0.0" />
|
|
267
|
+
|
|
268
|
+
Normalize an angle (degrees ×10000) to the range [0, 3600000).
|
|
269
|
+
|
|
270
|
+
```redscript
|
|
271
|
+
fn angle_normalize(deg: int): int
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
**Parameters**
|
|
275
|
+
|
|
276
|
+
| Parameter | Description |
|
|
277
|
+
|-----------|-------------|
|
|
278
|
+
| `deg` | Angle in degrees ×10000 (may be negative or >= 360°) |
|
|
279
|
+
|
|
280
|
+
**Returns:** Equivalent angle in [0, 3600000)
|
|
281
|
+
|
|
282
|
+
**Example**
|
|
283
|
+
|
|
284
|
+
```redscript
|
|
285
|
+
let a: int = angle_normalize(-900000) // result: 2700000 (270°)
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
---
|
|
289
|
+
|
|
290
|
+
## `angle_diff` <Badge type="info" text="v1.0.0" />
|
|
291
|
+
|
|
292
|
+
Compute the signed shortest angular difference between two angles (degrees ×10000).
|
|
293
|
+
|
|
294
|
+
```redscript
|
|
295
|
+
fn angle_diff(a: int, b: int): int
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
**Parameters**
|
|
299
|
+
|
|
300
|
+
| Parameter | Description |
|
|
301
|
+
|-----------|-------------|
|
|
302
|
+
| `a` | Starting angle ×10000 |
|
|
303
|
+
| `b` | Target angle ×10000 |
|
|
304
|
+
|
|
305
|
+
**Returns:** Signed difference in (-1800000, 1800000] (shortest arc b - a)
|
|
306
|
+
|
|
307
|
+
**Example**
|
|
308
|
+
|
|
309
|
+
```redscript
|
|
310
|
+
let diff: int = angle_diff(3500000, 100000) // ≈ -3400000 → wraps to short arc
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
---
|
|
314
|
+
|
|
315
|
+
## `mc_day_angle` <Badge type="info" text="v1.0.0" />
|
|
316
|
+
|
|
317
|
+
Convert Minecraft daytime ticks to sun angle in degrees ×10000.
|
|
318
|
+
|
|
319
|
+
```redscript
|
|
320
|
+
fn mc_day_angle(daytime: int): int
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
**Parameters**
|
|
324
|
+
|
|
325
|
+
| Parameter | Description |
|
|
326
|
+
|-----------|-------------|
|
|
327
|
+
| `daytime` | /time query daytime value (0-23999; 0=dawn, 6000=noon) |
|
|
328
|
+
|
|
329
|
+
**Returns:** Sun angle in [0, 3600000) degrees ×10000
|
|
330
|
+
|
|
331
|
+
**Example**
|
|
332
|
+
|
|
333
|
+
```redscript
|
|
334
|
+
let sun: int = mc_day_angle(6000) // noon → 1800000 (180°)
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
---
|
|
338
|
+
|
|
339
|
+
## `in_cylinder` <Badge type="info" text="v1.0.0" />
|
|
340
|
+
|
|
341
|
+
Test whether a point is inside a vertical cylinder (XZ circle with Y bounds).
|
|
342
|
+
|
|
343
|
+
```redscript
|
|
344
|
+
fn in_cylinder(px: int, py: int, pz: int, cx: int, cz: int, radius: int, y_lo: int, y_hi: int): int
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
**Parameters**
|
|
348
|
+
|
|
349
|
+
| Parameter | Description |
|
|
350
|
+
|-----------|-------------|
|
|
351
|
+
| `px` | Point X ×10000 |
|
|
352
|
+
| `py` | Point Y ×10000 |
|
|
353
|
+
| `pz` | Point Z ×10000 |
|
|
354
|
+
| `cx` | Cylinder center X ×10000 |
|
|
355
|
+
| `cz` | Cylinder center Z ×10000 |
|
|
356
|
+
| `radius` | Cylinder radius ×10000 (keep ≤ 46340 to avoid overflow) |
|
|
357
|
+
| `y_lo` | Y lower bound ×10000 (inclusive) |
|
|
358
|
+
| `y_hi` | Y upper bound ×10000 (inclusive) |
|
|
359
|
+
|
|
360
|
+
**Returns:** 1 if point is inside the cylinder, 0 otherwise
|
|
361
|
+
|
|
362
|
+
**Example**
|
|
363
|
+
|
|
364
|
+
```redscript
|
|
365
|
+
let hit: int = in_cylinder(100000, 640000, 100000, 0, 0, 80000, 600000, 800000)
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
---
|
|
369
|
+
|
|
370
|
+
## `in_cone` <Badge type="info" text="v1.0.0" />
|
|
371
|
+
|
|
372
|
+
Test whether a point is inside an upright cone (axis along +Y or -Y from apex).
|
|
373
|
+
|
|
374
|
+
```redscript
|
|
375
|
+
fn in_cone(px: int, py: int, pz: int, apex_x: int, apex_y: int, apex_z: int, dir_y: int, half_angle_tan: int, height: int): int
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
**Parameters**
|
|
379
|
+
|
|
380
|
+
| Parameter | Description |
|
|
381
|
+
|-----------|-------------|
|
|
382
|
+
| `px` | Point X ×10000 |
|
|
383
|
+
| `py` | Point Y ×10000 |
|
|
384
|
+
| `pz` | Point Z ×10000 |
|
|
385
|
+
| `apex_x` | Cone apex X ×10000 |
|
|
386
|
+
| `apex_y` | Cone apex Y ×10000 |
|
|
387
|
+
| `apex_z` | Cone apex Z ×10000 |
|
|
388
|
+
| `dir_y` | Cone direction: positive = upward, negative = downward |
|
|
389
|
+
| `half_angle_tan` | tan(half-angle) ×10000 (45° = 10000, 30° = 5773) |
|
|
390
|
+
| `height` | Cone height ×10000 |
|
|
391
|
+
|
|
392
|
+
**Returns:** 1 if point is inside the cone, 0 otherwise
|
|
393
|
+
|
|
394
|
+
**Example**
|
|
395
|
+
|
|
396
|
+
```redscript
|
|
397
|
+
let hit: int = in_cone(px, py, pz, apex_x, apex_y, apex_z, 1, 10000, 50000)
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
---
|
|
401
|
+
|
|
402
|
+
## `in_sector_2d` <Badge type="info" text="v1.0.0" />
|
|
403
|
+
|
|
404
|
+
Test whether a 2D point is inside a sector (pie-slice) in the XZ plane.
|
|
405
|
+
|
|
406
|
+
```redscript
|
|
407
|
+
fn in_sector_2d(px: int, pz: int, cx: int, cz: int, dir_angle: int, half_angle: int, radius: int): int
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
**Parameters**
|
|
411
|
+
|
|
412
|
+
| Parameter | Description |
|
|
413
|
+
|-----------|-------------|
|
|
414
|
+
| `px` | Point X ×10000 |
|
|
415
|
+
| `pz` | Point Z ×10000 |
|
|
416
|
+
| `cx` | Sector center X ×10000 |
|
|
417
|
+
| `cz` | Sector center Z ×10000 |
|
|
418
|
+
| `dir_angle` | Sector center direction in ×10000 radians (0 = +X, 628318 = 2π) |
|
|
419
|
+
| `half_angle` | Half-width of sector in ×10000 radians |
|
|
420
|
+
| `radius` | Maximum radius (same units as px, pz) |
|
|
421
|
+
|
|
422
|
+
**Returns:** 1 if point is within the sector, 0 otherwise
|
|
423
|
+
|
|
424
|
+
**Example**
|
|
425
|
+
|
|
426
|
+
```redscript
|
|
427
|
+
let hit: int = in_sector_2d(px, pz, 0, 0, 0, 157079, 100000) // quarter-circle facing +X
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
---
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
# Graph
|
|
2
|
+
|
|
3
|
+
> Auto-generated from `src/stdlib/graph.mcrs` — do not edit manually.
|
|
4
|
+
|
|
5
|
+
## API
|
|
6
|
+
|
|
7
|
+
- [graph_is_valid_node](#graph-is-valid-node)
|
|
8
|
+
- [graph_new](#graph-new)
|
|
9
|
+
- [graph_add_edge](#graph-add-edge)
|
|
10
|
+
- [graph_add_undirected](#graph-add-undirected)
|
|
11
|
+
- [graph_node_count](#graph-node-count)
|
|
12
|
+
- [graph_edge_count](#graph-edge-count)
|
|
13
|
+
- [graph_bfs](#graph-bfs)
|
|
14
|
+
- [graph_dfs](#graph-dfs)
|
|
15
|
+
- [graph_has_path](#graph-has-path)
|
|
16
|
+
- [graph_shortest_path](#graph-shortest-path)
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## `graph_is_valid_node` <Badge type="info" text="v1.0.0" />
|
|
21
|
+
|
|
22
|
+
Check whether a node index is valid for this graph.
|
|
23
|
+
|
|
24
|
+
```redscript
|
|
25
|
+
fn graph_is_valid_node(g: int[], node: int): int
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
**Parameters**
|
|
29
|
+
|
|
30
|
+
| Parameter | Description |
|
|
31
|
+
|-----------|-------------|
|
|
32
|
+
| `g` | Graph array (from graph_new) |
|
|
33
|
+
| `node` | Node index to validate |
|
|
34
|
+
|
|
35
|
+
**Returns:** 1 if node is in [0, node_count), 0 otherwise
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## `graph_new` <Badge type="info" text="v1.0.0" />
|
|
40
|
+
|
|
41
|
+
Create a new empty graph with n nodes and capacity for 256 directed edges.
|
|
42
|
+
|
|
43
|
+
```redscript
|
|
44
|
+
fn graph_new(n: int): int[]
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**Parameters**
|
|
48
|
+
|
|
49
|
+
| Parameter | Description |
|
|
50
|
+
|-----------|-------------|
|
|
51
|
+
| `n` | Number of nodes (clamped to [0, 64]) |
|
|
52
|
+
|
|
53
|
+
**Returns:** Initialized graph int[] with g[0]=0 (edges), g[1]=n (nodes)
|
|
54
|
+
|
|
55
|
+
**Example**
|
|
56
|
+
|
|
57
|
+
```redscript
|
|
58
|
+
let g: int[] = graph_new(5) // graph with 5 nodes, no edges
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## `graph_add_edge` <Badge type="info" text="v1.0.0" />
|
|
64
|
+
|
|
65
|
+
Add a directed weighted edge to the graph.
|
|
66
|
+
|
|
67
|
+
```redscript
|
|
68
|
+
fn graph_add_edge(g: int[], src: int, dst: int, weight: int): int[]
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**Parameters**
|
|
72
|
+
|
|
73
|
+
| Parameter | Description |
|
|
74
|
+
|-----------|-------------|
|
|
75
|
+
| `g` | Graph array |
|
|
76
|
+
| `src` | Source node index |
|
|
77
|
+
| `dst` | Destination node index |
|
|
78
|
+
| `weight` | Edge weight (use 1 for unweighted graphs) |
|
|
79
|
+
|
|
80
|
+
**Returns:** Updated graph array; silently ignores invalid nodes or full edge list
|
|
81
|
+
|
|
82
|
+
**Example**
|
|
83
|
+
|
|
84
|
+
```redscript
|
|
85
|
+
g = graph_add_edge(g, 0, 1, 5) // edge from 0 to 1 with weight 5
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## `graph_add_undirected` <Badge type="info" text="v1.0.0" />
|
|
91
|
+
|
|
92
|
+
Add an undirected weighted edge (adds both a→b and b→a directed edges).
|
|
93
|
+
|
|
94
|
+
```redscript
|
|
95
|
+
fn graph_add_undirected(g: int[], a: int, b: int, weight: int): int[]
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**Parameters**
|
|
99
|
+
|
|
100
|
+
| Parameter | Description |
|
|
101
|
+
|-----------|-------------|
|
|
102
|
+
| `g` | Graph array |
|
|
103
|
+
| `a` | First node index |
|
|
104
|
+
| `b` | Second node index |
|
|
105
|
+
| `weight` | Edge weight |
|
|
106
|
+
|
|
107
|
+
**Returns:** Updated graph array with two directed edges added
|
|
108
|
+
|
|
109
|
+
**Example**
|
|
110
|
+
|
|
111
|
+
```redscript
|
|
112
|
+
g = graph_add_undirected(g, 2, 3, 2) // bidirectional edge between 2 and 3
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## `graph_node_count` <Badge type="info" text="v1.0.0" />
|
|
118
|
+
|
|
119
|
+
Return the number of nodes in the graph.
|
|
120
|
+
|
|
121
|
+
```redscript
|
|
122
|
+
fn graph_node_count(g: int[]): int
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**Parameters**
|
|
126
|
+
|
|
127
|
+
| Parameter | Description |
|
|
128
|
+
|-----------|-------------|
|
|
129
|
+
| `g` | Graph array |
|
|
130
|
+
|
|
131
|
+
**Returns:** Node count (g[1])
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## `graph_edge_count` <Badge type="info" text="v1.0.0" />
|
|
136
|
+
|
|
137
|
+
Return the number of directed edges in the graph.
|
|
138
|
+
|
|
139
|
+
```redscript
|
|
140
|
+
fn graph_edge_count(g: int[]): int
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
**Parameters**
|
|
144
|
+
|
|
145
|
+
| Parameter | Description |
|
|
146
|
+
|-----------|-------------|
|
|
147
|
+
| `g` | Graph array |
|
|
148
|
+
|
|
149
|
+
**Returns:** Edge count (g[0])
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## `graph_bfs` <Badge type="info" text="v1.0.0" />
|
|
154
|
+
|
|
155
|
+
Breadth-first search from a start node, returning visit order.
|
|
156
|
+
|
|
157
|
+
```redscript
|
|
158
|
+
fn graph_bfs(g: int[], start: int, out_visited: int[]): int[]
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
**Parameters**
|
|
162
|
+
|
|
163
|
+
| Parameter | Description |
|
|
164
|
+
|-----------|-------------|
|
|
165
|
+
| `g` | Graph array |
|
|
166
|
+
| `start` | Starting node index |
|
|
167
|
+
| `out_visited` | int[] of length >= node_count; cells set to 1 for visited nodes |
|
|
168
|
+
|
|
169
|
+
**Returns:** int[] of node indices in BFS visit order; empty if start is invalid
|
|
170
|
+
|
|
171
|
+
**Example**
|
|
172
|
+
|
|
173
|
+
```redscript
|
|
174
|
+
let vis: int[] = [0, 0, 0, 0, 0]
|
|
175
|
+
let order: int[] = graph_bfs(g, 0, vis)
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## `graph_dfs` <Badge type="info" text="v1.0.0" />
|
|
181
|
+
|
|
182
|
+
Depth-first search from a start node, returning visit order.
|
|
183
|
+
|
|
184
|
+
```redscript
|
|
185
|
+
fn graph_dfs(g: int[], start: int, out_visited: int[]): int[]
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
**Parameters**
|
|
189
|
+
|
|
190
|
+
| Parameter | Description |
|
|
191
|
+
|-----------|-------------|
|
|
192
|
+
| `g` | Graph array |
|
|
193
|
+
| `start` | Starting node index |
|
|
194
|
+
| `out_visited` | int[] of length >= node_count; cells set to 1 for visited nodes |
|
|
195
|
+
|
|
196
|
+
**Returns:** int[] of node indices in DFS visit order (iterative, stack-based)
|
|
197
|
+
|
|
198
|
+
**Example**
|
|
199
|
+
|
|
200
|
+
```redscript
|
|
201
|
+
let vis: int[] = [0, 0, 0, 0, 0]
|
|
202
|
+
let order: int[] = graph_dfs(g, 0, vis)
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## `graph_has_path` <Badge type="info" text="v1.0.0" />
|
|
208
|
+
|
|
209
|
+
Check whether a path exists between two nodes using BFS.
|
|
210
|
+
|
|
211
|
+
```redscript
|
|
212
|
+
fn graph_has_path(g: int[], src: int, dst: int): int
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
**Parameters**
|
|
216
|
+
|
|
217
|
+
| Parameter | Description |
|
|
218
|
+
|-----------|-------------|
|
|
219
|
+
| `g` | Graph array |
|
|
220
|
+
| `src` | Source node index |
|
|
221
|
+
| `dst` | Destination node index |
|
|
222
|
+
|
|
223
|
+
**Returns:** 1 if a directed path from src to dst exists, 0 otherwise
|
|
224
|
+
|
|
225
|
+
**Example**
|
|
226
|
+
|
|
227
|
+
```redscript
|
|
228
|
+
let reachable: int = graph_has_path(g, 0, 3)
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## `graph_shortest_path` <Badge type="info" text="v1.0.0" />
|
|
234
|
+
|
|
235
|
+
Find the shortest weighted path from src to all nodes using Dijkstra's algorithm.
|
|
236
|
+
|
|
237
|
+
```redscript
|
|
238
|
+
fn graph_shortest_path(g: int[], src: int, dst: int, out_dist: int[]): int
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
**Parameters**
|
|
242
|
+
|
|
243
|
+
| Parameter | Description |
|
|
244
|
+
|-----------|-------------|
|
|
245
|
+
| `g` | Graph array |
|
|
246
|
+
| `src` | Source node index |
|
|
247
|
+
| `dst` | Destination node index (for return value) |
|
|
248
|
+
| `out_dist` | int[] of length >= node_count; filled with shortest distances (-1 if unreachable) |
|
|
249
|
+
|
|
250
|
+
**Returns:** Shortest distance from src to dst, or -1 if unreachable
|
|
251
|
+
|
|
252
|
+
**Example**
|
|
253
|
+
|
|
254
|
+
```redscript
|
|
255
|
+
let dist: int[] = [0, 0, 0, 0, 0]
|
|
256
|
+
let d: int = graph_shortest_path(g, 0, 3, dist)
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
---
|