redscript-mc 1.2.26 → 1.2.28
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 +78 -9
- package/README.zh.md +72 -4
- package/dist/__tests__/cli.test.js +13 -13
- package/dist/__tests__/optimizer-advanced.test.js +4 -4
- package/dist/__tests__/stdlib-advanced.test.js +114 -0
- package/dist/__tests__/stdlib-bigint.test.d.ts +7 -0
- package/dist/__tests__/stdlib-bigint.test.js +428 -0
- package/dist/cli.js +13 -5
- package/dist/codegen/mcfunction/index.d.ts +4 -0
- package/dist/codegen/mcfunction/index.js +9 -4
- package/dist/compile.d.ts +4 -0
- package/dist/compile.js +9 -1
- package/dist/data/arena/function/__load.mcfunction +6 -0
- package/dist/data/arena/function/__tick.mcfunction +2 -0
- package/dist/data/arena/function/announce_leaders/else_1.mcfunction +3 -0
- package/dist/data/arena/function/announce_leaders/foreach_0/merge_2.mcfunction +1 -0
- package/dist/data/arena/function/announce_leaders/foreach_0/then_0.mcfunction +3 -0
- package/dist/data/arena/function/announce_leaders/foreach_0.mcfunction +7 -0
- package/dist/data/arena/function/announce_leaders/foreach_1/merge_2.mcfunction +1 -0
- package/dist/data/arena/function/announce_leaders/foreach_1/then_0.mcfunction +4 -0
- package/dist/data/arena/function/announce_leaders/foreach_1.mcfunction +6 -0
- package/dist/data/arena/function/announce_leaders/merge_2.mcfunction +1 -0
- package/dist/data/arena/function/announce_leaders/then_0.mcfunction +4 -0
- package/dist/data/arena/function/announce_leaders.mcfunction +6 -0
- package/dist/data/arena/function/arena_tick/merge_2.mcfunction +1 -0
- package/dist/data/arena/function/arena_tick/then_0.mcfunction +4 -0
- package/dist/data/arena/function/arena_tick.mcfunction +11 -0
- package/dist/data/counter/function/__load.mcfunction +5 -0
- package/dist/data/counter/function/__tick.mcfunction +2 -0
- package/dist/data/counter/function/counter_tick/merge_2.mcfunction +1 -0
- package/dist/data/counter/function/counter_tick/then_0.mcfunction +3 -0
- package/dist/data/counter/function/counter_tick.mcfunction +11 -0
- package/dist/data/gcd2/function/__load.mcfunction +3 -0
- package/dist/data/gcd2/function/abs/merge_2.mcfunction +3 -0
- package/dist/data/gcd2/function/abs/then_0.mcfunction +5 -0
- package/dist/data/gcd2/function/abs.mcfunction +7 -0
- package/dist/data/gcd2/function/gcd/loop_body_1.mcfunction +7 -0
- package/dist/data/gcd2/function/gcd/loop_check_0.mcfunction +5 -0
- package/dist/data/gcd2/function/gcd/loop_exit_2.mcfunction +3 -0
- package/dist/data/gcd2/function/gcd.mcfunction +14 -0
- package/dist/data/gcd3/function/__load.mcfunction +3 -0
- package/dist/data/gcd3/function/abs/merge_2.mcfunction +3 -0
- package/dist/data/gcd3/function/abs/then_0.mcfunction +5 -0
- package/dist/data/gcd3/function/abs.mcfunction +7 -0
- package/dist/data/gcd3/function/gcd/loop_body_1.mcfunction +7 -0
- package/dist/data/gcd3/function/gcd/loop_check_0.mcfunction +5 -0
- package/dist/data/gcd3/function/gcd/loop_exit_2.mcfunction +3 -0
- package/dist/data/gcd3/function/gcd.mcfunction +14 -0
- package/dist/data/gcd3/function/test.mcfunction +7 -0
- package/dist/data/gcd3nm/function/__load.mcfunction +3 -0
- package/dist/data/gcd3nm/function/abs/merge_2.mcfunction +3 -0
- package/dist/data/gcd3nm/function/abs/then_0.mcfunction +5 -0
- package/dist/data/gcd3nm/function/abs.mcfunction +7 -0
- package/dist/data/gcd3nm/function/gcd/loop_body_1.mcfunction +7 -0
- package/dist/data/gcd3nm/function/gcd/loop_check_0.mcfunction +5 -0
- package/dist/data/gcd3nm/function/gcd/loop_exit_2.mcfunction +3 -0
- package/dist/data/gcd3nm/function/gcd.mcfunction +14 -0
- package/dist/data/gcd3nm/function/test.mcfunction +7 -0
- package/dist/data/gcd_test/function/__load.mcfunction +3 -0
- package/dist/data/gcd_test/function/abs/merge_2.mcfunction +3 -0
- package/dist/data/gcd_test/function/abs/then_0.mcfunction +5 -0
- package/dist/data/gcd_test/function/abs.mcfunction +7 -0
- package/dist/data/gcd_test/function/gcd/loop_body_1.mcfunction +7 -0
- package/dist/data/gcd_test/function/gcd/loop_check_0.mcfunction +5 -0
- package/dist/data/gcd_test/function/gcd/loop_exit_2.mcfunction +3 -0
- package/dist/data/gcd_test/function/gcd.mcfunction +14 -0
- package/dist/data/isqrttest/function/__load.mcfunction +6 -0
- package/dist/data/isqrttest/function/isqrt/loop_body_4.mcfunction +12 -0
- package/dist/data/isqrttest/function/isqrt/loop_check_3.mcfunction +5 -0
- package/dist/data/isqrttest/function/isqrt/loop_exit_5.mcfunction +3 -0
- package/dist/data/isqrttest/function/isqrt/merge_2.mcfunction +4 -0
- package/dist/data/isqrttest/function/isqrt/merge_8.mcfunction +6 -0
- package/dist/data/isqrttest/function/isqrt/then_0.mcfunction +3 -0
- package/dist/data/isqrttest/function/isqrt/then_6.mcfunction +3 -0
- package/dist/data/isqrttest/function/isqrt.mcfunction +7 -0
- package/dist/data/isqrttest/function/test.mcfunction +6 -0
- package/dist/data/mathtest/function/__load.mcfunction +3 -0
- package/dist/data/mathtest/function/abs/merge_2.mcfunction +3 -0
- package/dist/data/mathtest/function/abs/then_0.mcfunction +5 -0
- package/dist/data/mathtest/function/abs.mcfunction +6 -0
- package/dist/data/mathtest/function/test.mcfunction +5 -0
- package/dist/data/minecraft/tags/function/load.json +5 -0
- package/dist/data/minecraft/tags/function/tick.json +5 -0
- package/dist/data/mypack/function/__load.mcfunction +13 -0
- package/dist/data/mypack/function/_atan_init.mcfunction +2 -0
- package/dist/data/mypack/function/abs/merge_2.mcfunction +3 -0
- package/dist/data/mypack/function/abs/then_0.mcfunction +5 -0
- package/dist/data/mypack/function/abs.mcfunction +6 -0
- package/dist/data/mypack/function/atan2_fixed/__sgi_1.mcfunction +2 -0
- package/dist/data/mypack/function/atan2_fixed/else_34.mcfunction +3 -0
- package/dist/data/mypack/function/atan2_fixed/loop_body_31.mcfunction +19 -0
- package/dist/data/mypack/function/atan2_fixed/loop_check_30.mcfunction +5 -0
- package/dist/data/mypack/function/atan2_fixed/loop_exit_32.mcfunction +6 -0
- package/dist/data/mypack/function/atan2_fixed/merge_11.mcfunction +6 -0
- package/dist/data/mypack/function/atan2_fixed/merge_14.mcfunction +3 -0
- package/dist/data/mypack/function/atan2_fixed/merge_17.mcfunction +6 -0
- package/dist/data/mypack/function/atan2_fixed/merge_2.mcfunction +5 -0
- package/dist/data/mypack/function/atan2_fixed/merge_20.mcfunction +5 -0
- package/dist/data/mypack/function/atan2_fixed/merge_23.mcfunction +5 -0
- package/dist/data/mypack/function/atan2_fixed/merge_26.mcfunction +6 -0
- package/dist/data/mypack/function/atan2_fixed/merge_29.mcfunction +4 -0
- package/dist/data/mypack/function/atan2_fixed/merge_38.mcfunction +5 -0
- package/dist/data/mypack/function/atan2_fixed/merge_41.mcfunction +5 -0
- package/dist/data/mypack/function/atan2_fixed/merge_44.mcfunction +5 -0
- package/dist/data/mypack/function/atan2_fixed/merge_47.mcfunction +5 -0
- package/dist/data/mypack/function/atan2_fixed/merge_5.mcfunction +5 -0
- package/dist/data/mypack/function/atan2_fixed/merge_8.mcfunction +3 -0
- package/dist/data/mypack/function/atan2_fixed/then_0.mcfunction +5 -0
- package/dist/data/mypack/function/atan2_fixed/then_12.mcfunction +3 -0
- package/dist/data/mypack/function/atan2_fixed/then_15.mcfunction +5 -0
- package/dist/data/mypack/function/atan2_fixed/then_18.mcfunction +5 -0
- package/dist/data/mypack/function/atan2_fixed/then_21.mcfunction +3 -0
- package/dist/data/mypack/function/atan2_fixed/then_24.mcfunction +3 -0
- package/dist/data/mypack/function/atan2_fixed/then_27.mcfunction +6 -0
- package/dist/data/mypack/function/atan2_fixed/then_3.mcfunction +3 -0
- package/dist/data/mypack/function/atan2_fixed/then_33.mcfunction +5 -0
- package/dist/data/mypack/function/atan2_fixed/then_36.mcfunction +5 -0
- package/dist/data/mypack/function/atan2_fixed/then_39.mcfunction +5 -0
- package/dist/data/mypack/function/atan2_fixed/then_42.mcfunction +3 -0
- package/dist/data/mypack/function/atan2_fixed/then_45.mcfunction +5 -0
- package/dist/data/mypack/function/atan2_fixed/then_6.mcfunction +3 -0
- package/dist/data/mypack/function/atan2_fixed/then_9.mcfunction +5 -0
- package/dist/data/mypack/function/atan2_fixed.mcfunction +7 -0
- package/dist/data/mypack/function/my_game.mcfunction +10 -0
- package/dist/data/quiz/function/__load.mcfunction +16 -0
- package/dist/data/quiz/function/__tick.mcfunction +6 -0
- package/dist/data/quiz/function/__trigger_quiz_a_dispatch.mcfunction +4 -0
- package/dist/data/quiz/function/__trigger_quiz_b_dispatch.mcfunction +4 -0
- package/dist/data/quiz/function/__trigger_quiz_c_dispatch.mcfunction +4 -0
- package/dist/data/quiz/function/__trigger_quiz_start_dispatch.mcfunction +4 -0
- package/dist/data/quiz/function/answer_a.mcfunction +4 -0
- package/dist/data/quiz/function/answer_b.mcfunction +4 -0
- package/dist/data/quiz/function/answer_c.mcfunction +4 -0
- package/dist/data/quiz/function/ask_question/else_1.mcfunction +5 -0
- package/dist/data/quiz/function/ask_question/else_4.mcfunction +5 -0
- package/dist/data/quiz/function/ask_question/else_7.mcfunction +4 -0
- package/dist/data/quiz/function/ask_question/merge_2.mcfunction +1 -0
- package/dist/data/quiz/function/ask_question/merge_5.mcfunction +2 -0
- package/dist/data/quiz/function/ask_question/merge_8.mcfunction +2 -0
- package/dist/data/quiz/function/ask_question/then_0.mcfunction +4 -0
- package/dist/data/quiz/function/ask_question/then_3.mcfunction +4 -0
- package/dist/data/quiz/function/ask_question/then_6.mcfunction +4 -0
- package/dist/data/quiz/function/ask_question.mcfunction +7 -0
- package/dist/data/quiz/function/finish_quiz.mcfunction +6 -0
- package/dist/data/quiz/function/handle_answer/else_1.mcfunction +5 -0
- package/dist/data/quiz/function/handle_answer/else_10.mcfunction +3 -0
- package/dist/data/quiz/function/handle_answer/else_16.mcfunction +3 -0
- package/dist/data/quiz/function/handle_answer/else_4.mcfunction +3 -0
- package/dist/data/quiz/function/handle_answer/else_7.mcfunction +5 -0
- package/dist/data/quiz/function/handle_answer/merge_11.mcfunction +2 -0
- package/dist/data/quiz/function/handle_answer/merge_14.mcfunction +2 -0
- package/dist/data/quiz/function/handle_answer/merge_17.mcfunction +2 -0
- package/dist/data/quiz/function/handle_answer/merge_2.mcfunction +8 -0
- package/dist/data/quiz/function/handle_answer/merge_5.mcfunction +2 -0
- package/dist/data/quiz/function/handle_answer/merge_8.mcfunction +2 -0
- package/dist/data/quiz/function/handle_answer/then_0.mcfunction +5 -0
- package/dist/data/quiz/function/handle_answer/then_12.mcfunction +5 -0
- package/dist/data/quiz/function/handle_answer/then_15.mcfunction +6 -0
- package/dist/data/quiz/function/handle_answer/then_3.mcfunction +6 -0
- package/dist/data/quiz/function/handle_answer/then_6.mcfunction +5 -0
- package/dist/data/quiz/function/handle_answer/then_9.mcfunction +6 -0
- package/dist/data/quiz/function/handle_answer.mcfunction +11 -0
- package/dist/data/quiz/function/start_quiz.mcfunction +5 -0
- package/dist/data/reqtest/function/__load.mcfunction +4 -0
- package/dist/data/reqtest/function/_table_init.mcfunction +2 -0
- package/dist/data/reqtest/function/no_trig.mcfunction +3 -0
- package/dist/data/reqtest/function/use_table.mcfunction +4 -0
- package/dist/data/reqtest2/function/__load.mcfunction +3 -0
- package/dist/data/reqtest2/function/no_trig.mcfunction +3 -0
- package/dist/data/runtime/function/__load.mcfunction +5 -0
- package/dist/data/runtime/function/__tick.mcfunction +2 -0
- package/dist/data/runtime/function/counter_tick/then_0.mcfunction +3 -0
- package/dist/data/runtime/function/counter_tick.mcfunction +13 -0
- package/dist/data/shop/function/__load.mcfunction +7 -0
- package/dist/data/shop/function/__tick.mcfunction +3 -0
- package/dist/data/shop/function/__trigger_shop_buy_dispatch.mcfunction +4 -0
- package/dist/data/shop/function/complete_purchase/else_1.mcfunction +5 -0
- package/dist/data/shop/function/complete_purchase/else_4.mcfunction +5 -0
- package/dist/data/shop/function/complete_purchase/else_7.mcfunction +3 -0
- package/dist/data/shop/function/complete_purchase/merge_2.mcfunction +2 -0
- package/dist/data/shop/function/complete_purchase/merge_5.mcfunction +2 -0
- package/dist/data/shop/function/complete_purchase/merge_8.mcfunction +2 -0
- package/dist/data/shop/function/complete_purchase/then_0.mcfunction +4 -0
- package/dist/data/shop/function/complete_purchase/then_3.mcfunction +4 -0
- package/dist/data/shop/function/complete_purchase/then_6.mcfunction +4 -0
- package/dist/data/shop/function/complete_purchase.mcfunction +7 -0
- package/dist/data/shop/function/handle_shop_trigger.mcfunction +3 -0
- package/dist/data/swap_test/function/__load.mcfunction +3 -0
- package/dist/data/swap_test/function/gcd_old/loop_body_1.mcfunction +7 -0
- package/dist/data/swap_test/function/gcd_old/loop_check_0.mcfunction +5 -0
- package/dist/data/swap_test/function/gcd_old/loop_exit_2.mcfunction +3 -0
- package/dist/data/swap_test/function/gcd_old.mcfunction +8 -0
- package/dist/data/turret/function/__load.mcfunction +5 -0
- package/dist/data/turret/function/__tick.mcfunction +4 -0
- package/dist/data/turret/function/__trigger_deploy_turret_dispatch.mcfunction +4 -0
- package/dist/data/turret/function/deploy_turret.mcfunction +8 -0
- package/dist/data/turret/function/turret_tick/at_1.mcfunction +2 -0
- package/dist/data/turret/function/turret_tick/foreach_0.mcfunction +2 -0
- package/dist/data/turret/function/turret_tick/foreach_2.mcfunction +2 -0
- package/dist/data/turret/function/turret_tick/tick_body.mcfunction +3 -0
- package/dist/data/turret/function/turret_tick/tick_skip.mcfunction +1 -0
- package/dist/data/turret/function/turret_tick.mcfunction +5 -0
- package/dist/gcd2.map.json +15 -0
- package/dist/gcd3.map.json +17 -0
- package/dist/gcd_test.map.json +15 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +11 -6
- package/dist/isqrttest.map.json +15 -0
- package/dist/lowering/index.d.ts +3 -0
- package/dist/lowering/index.js +161 -64
- package/dist/mathtest.map.json +6 -0
- package/dist/mypack.map.json +27 -0
- package/dist/optimizer/commands.d.ts +1 -0
- package/dist/optimizer/commands.js +18 -11
- package/dist/optimizer/structure.d.ts +1 -0
- package/dist/optimizer/structure.js +6 -1
- package/dist/pack.mcmeta +6 -0
- package/dist/reqtest.map.json +4 -0
- package/dist/reqtest2.map.json +4 -0
- package/dist/runtime/index.js +26 -5
- package/dist/runtime.map.json +7 -0
- package/dist/swap_test.map.json +14 -0
- package/editors/vscode/package-lock.json +3 -3
- package/editors/vscode/package.json +1 -1
- package/examples/math-showcase.mcrs +146 -0
- package/examples/readme-demo.mcrs +92 -0
- package/examples/showcase.mcrs +505 -0
- package/package.json +1 -1
- package/src/__tests__/cli.test.ts +13 -13
- package/src/__tests__/optimizer-advanced.test.ts +4 -4
- package/src/__tests__/stdlib-advanced.test.ts +120 -0
- package/src/__tests__/stdlib-bigint.test.ts +427 -0
- package/src/cli.ts +14 -5
- package/src/codegen/mcfunction/index.ts +14 -5
- package/src/compile.ts +15 -2
- package/src/index.ts +17 -7
- package/src/lowering/index.ts +165 -63
- package/src/optimizer/commands.ts +18 -12
- package/src/optimizer/structure.ts +6 -2
- package/src/runtime/index.ts +27 -5
- package/src/stdlib/advanced.mcrs +81 -0
- package/src/stdlib/bigint.mcrs +205 -0
- package/src/stdlib/math.mcrs +19 -6
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# block: entry
|
|
2
|
+
execute store result score $t0 rs run scoreboard players get arena ticks
|
|
3
|
+
scoreboard players operation $t1 rs = $t0 rs
|
|
4
|
+
scoreboard players operation $t1 rs += $const_1 rs
|
|
5
|
+
execute store result score arena ticks run scoreboard players get $t2 rs
|
|
6
|
+
scoreboard players operation $t3 rs = $t1 rs
|
|
7
|
+
scoreboard players operation $t3 rs %= $const_200 rs
|
|
8
|
+
scoreboard players set $t4 rs 0
|
|
9
|
+
execute if score $t3 rs = $const_0 rs run scoreboard players set $t4 rs 1
|
|
10
|
+
execute if score $t4 rs matches 1.. run function arena:arena_tick/then_0
|
|
11
|
+
execute if score $t4 rs matches ..0 run function arena:arena_tick/merge_2
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# block: merge_2
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# block: entry
|
|
2
|
+
execute store result score $t0 rs run scoreboard players get counter ticks
|
|
3
|
+
scoreboard players operation $t1 rs = $t0 rs
|
|
4
|
+
scoreboard players operation $t1 rs += $const_1 rs
|
|
5
|
+
execute store result score counter ticks run scoreboard players get $t2 rs
|
|
6
|
+
scoreboard players operation $t3 rs = $t1 rs
|
|
7
|
+
scoreboard players operation $t3 rs %= $const_100 rs
|
|
8
|
+
scoreboard players set $t4 rs 0
|
|
9
|
+
execute if score $t3 rs = $const_0 rs run scoreboard players set $t4 rs 1
|
|
10
|
+
execute if score $t4 rs matches 1.. run function counter:counter_tick/then_0
|
|
11
|
+
execute if score $t4 rs matches ..0 run function counter:counter_tick/merge_2
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# block: entry
|
|
2
|
+
scoreboard players operation $b rs = $c rs
|
|
3
|
+
scoreboard players operation $b rs = $d rs
|
|
4
|
+
scoreboard players set $e rs 0
|
|
5
|
+
execute if score $d rs < $a rs run scoreboard players set $e rs 1
|
|
6
|
+
execute if score $e rs matches 1.. run function gcd2:abs/then_0
|
|
7
|
+
execute if score $e rs matches ..0 run function gcd2:abs/merge_2
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# block: loop_body_1
|
|
2
|
+
scoreboard players operation $r rs = $b rs
|
|
3
|
+
scoreboard players operation $r rs %= $p rs
|
|
4
|
+
scoreboard players operation $s rs = $r rs
|
|
5
|
+
scoreboard players operation $b rs = $p rs
|
|
6
|
+
scoreboard players operation $p rs = $r rs
|
|
7
|
+
function gcd2:gcd/loop_check_0
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# block: entry
|
|
2
|
+
scoreboard players operation $i rs = $c rs
|
|
3
|
+
scoreboard players operation $j rs = $k rs
|
|
4
|
+
scoreboard players operation $i rs = $d rs
|
|
5
|
+
scoreboard players operation $j rs = $l rs
|
|
6
|
+
scoreboard players operation $m rs = $d rs
|
|
7
|
+
function gcd2:abs
|
|
8
|
+
scoreboard players operation $n rs = $g rs
|
|
9
|
+
scoreboard players operation $b rs = $n rs
|
|
10
|
+
scoreboard players operation $m rs = $l rs
|
|
11
|
+
function gcd2:abs
|
|
12
|
+
scoreboard players operation $o rs = $g rs
|
|
13
|
+
scoreboard players operation $p rs = $o rs
|
|
14
|
+
function gcd2:gcd/loop_check_0
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# block: entry
|
|
2
|
+
scoreboard players operation $b rs = $c rs
|
|
3
|
+
scoreboard players operation $b rs = $d rs
|
|
4
|
+
scoreboard players set $e rs 0
|
|
5
|
+
execute if score $d rs < $a rs run scoreboard players set $e rs 1
|
|
6
|
+
execute if score $e rs matches 1.. run function gcd3:abs/then_0
|
|
7
|
+
execute if score $e rs matches ..0 run function gcd3:abs/merge_2
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# block: loop_body_1
|
|
2
|
+
scoreboard players operation $r rs = $b rs
|
|
3
|
+
scoreboard players operation $r rs %= $p rs
|
|
4
|
+
scoreboard players operation $s rs = $r rs
|
|
5
|
+
scoreboard players operation $b rs = $p rs
|
|
6
|
+
scoreboard players operation $p rs = $r rs
|
|
7
|
+
function gcd3:gcd/loop_check_0
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# block: entry
|
|
2
|
+
scoreboard players operation $i rs = $c rs
|
|
3
|
+
scoreboard players operation $j rs = $k rs
|
|
4
|
+
scoreboard players operation $i rs = $d rs
|
|
5
|
+
scoreboard players operation $j rs = $l rs
|
|
6
|
+
scoreboard players operation $m rs = $d rs
|
|
7
|
+
function gcd3:abs
|
|
8
|
+
scoreboard players operation $n rs = $g rs
|
|
9
|
+
scoreboard players operation $b rs = $n rs
|
|
10
|
+
scoreboard players operation $m rs = $l rs
|
|
11
|
+
function gcd3:abs
|
|
12
|
+
scoreboard players operation $o rs = $g rs
|
|
13
|
+
scoreboard players operation $p rs = $o rs
|
|
14
|
+
function gcd3:gcd/loop_check_0
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# block: entry
|
|
2
|
+
scoreboard players set $m rs 12
|
|
3
|
+
scoreboard players set $t rs 8
|
|
4
|
+
function gcd3:gcd
|
|
5
|
+
scoreboard players operation $u rs = $g rs
|
|
6
|
+
scoreboard players operation $v rs = $u rs
|
|
7
|
+
execute store result score out gcd3.r run scoreboard players get $result rs
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# block: entry
|
|
2
|
+
scoreboard players operation $x rs = $p0 rs
|
|
3
|
+
scoreboard players operation $x rs = $p0 rs
|
|
4
|
+
scoreboard players set $_0 rs 0
|
|
5
|
+
execute if score $p0 rs < $const_0 rs run scoreboard players set $_0 rs 1
|
|
6
|
+
execute if score $_0 rs matches 1.. run function gcd3nm:abs/then_0
|
|
7
|
+
execute if score $_0 rs matches ..0 run function gcd3nm:abs/merge_2
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# block: loop_body_1
|
|
2
|
+
scoreboard players operation $_5 rs = $x rs
|
|
3
|
+
scoreboard players operation $_5 rs %= $y rs
|
|
4
|
+
scoreboard players operation $r rs = $_5 rs
|
|
5
|
+
scoreboard players operation $x rs = $y rs
|
|
6
|
+
scoreboard players operation $y rs = $_5 rs
|
|
7
|
+
function gcd3nm:gcd/loop_check_0
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# block: loop_check_0
|
|
2
|
+
scoreboard players set $_4 rs 0
|
|
3
|
+
execute if score $y rs > $const_0 rs run scoreboard players set $_4 rs 1
|
|
4
|
+
execute if score $_4 rs matches 1.. run function gcd3nm:gcd/loop_body_1
|
|
5
|
+
execute if score $_4 rs matches ..0 run function gcd3nm:gcd/loop_exit_2
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# block: entry
|
|
2
|
+
scoreboard players operation $a rs = $p0 rs
|
|
3
|
+
scoreboard players operation $b rs = $p1 rs
|
|
4
|
+
scoreboard players operation $a rs = $p0 rs
|
|
5
|
+
scoreboard players operation $b rs = $p1 rs
|
|
6
|
+
scoreboard players operation $p0 rs = $p0 rs
|
|
7
|
+
function gcd3nm:abs
|
|
8
|
+
scoreboard players operation $_2 rs = $ret rs
|
|
9
|
+
scoreboard players operation $x rs = $_2 rs
|
|
10
|
+
scoreboard players operation $p0 rs = $p1 rs
|
|
11
|
+
function gcd3nm:abs
|
|
12
|
+
scoreboard players operation $_3 rs = $ret rs
|
|
13
|
+
scoreboard players operation $y rs = $_3 rs
|
|
14
|
+
function gcd3nm:gcd/loop_check_0
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# block: entry
|
|
2
|
+
scoreboard players set $p0 rs 12
|
|
3
|
+
scoreboard players set $p1 rs 8
|
|
4
|
+
function gcd3nm:gcd
|
|
5
|
+
scoreboard players operation $_6 rs = $ret rs
|
|
6
|
+
scoreboard players operation $result rs = $_6 rs
|
|
7
|
+
execute store result score out gcd3nm.r run scoreboard players get $result rs
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# block: entry
|
|
2
|
+
scoreboard players operation $k rs = $c rs
|
|
3
|
+
scoreboard players operation $k rs = $f rs
|
|
4
|
+
scoreboard players set $r rs 0
|
|
5
|
+
execute if score $f rs < $a rs run scoreboard players set $r rs 1
|
|
6
|
+
execute if score $r rs matches 1.. run function gcd_test:abs/then_0
|
|
7
|
+
execute if score $r rs matches ..0 run function gcd_test:abs/merge_2
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# block: loop_body_1
|
|
2
|
+
scoreboard players operation $o rs = $m rs
|
|
3
|
+
scoreboard players operation $p rs = $k rs
|
|
4
|
+
scoreboard players operation $p rs %= $m rs
|
|
5
|
+
scoreboard players operation $m rs = $p rs
|
|
6
|
+
scoreboard players operation $k rs = $m rs
|
|
7
|
+
function gcd_test:gcd/loop_check_0
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# block: loop_check_0
|
|
2
|
+
scoreboard players set $n rs 0
|
|
3
|
+
execute if score $m rs > $a rs run scoreboard players set $n rs 1
|
|
4
|
+
execute if score $n rs matches 1.. run function gcd_test:gcd/loop_body_1
|
|
5
|
+
execute if score $n rs matches ..0 run function gcd_test:gcd/loop_exit_2
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# block: entry
|
|
2
|
+
scoreboard players operation $b rs = $c rs
|
|
3
|
+
scoreboard players operation $d rs = $e rs
|
|
4
|
+
scoreboard players operation $b rs = $f rs
|
|
5
|
+
scoreboard players operation $d rs = $g rs
|
|
6
|
+
scoreboard players operation $h rs = $f rs
|
|
7
|
+
function gcd_test:abs
|
|
8
|
+
scoreboard players operation $j rs = $i rs
|
|
9
|
+
scoreboard players operation $k rs = $j rs
|
|
10
|
+
scoreboard players operation $h rs = $g rs
|
|
11
|
+
function gcd_test:abs
|
|
12
|
+
scoreboard players operation $l rs = $i rs
|
|
13
|
+
scoreboard players operation $m rs = $l rs
|
|
14
|
+
function gcd_test:gcd/loop_check_0
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# block: loop_body_4
|
|
2
|
+
scoreboard players operation $m rs = $e rs
|
|
3
|
+
scoreboard players operation $m rs /= $k rs
|
|
4
|
+
scoreboard players operation $n rs = $k rs
|
|
5
|
+
scoreboard players operation $n rs += $m rs
|
|
6
|
+
scoreboard players operation $o rs = $n rs
|
|
7
|
+
scoreboard players operation $o rs /= $c rs
|
|
8
|
+
scoreboard players operation $p rs = $o rs
|
|
9
|
+
scoreboard players set $q rs 0
|
|
10
|
+
execute if score $o rs >= $k rs run scoreboard players set $q rs 1
|
|
11
|
+
execute if score $q rs matches 1.. run function isqrttest:isqrt/then_6
|
|
12
|
+
execute if score $q rs matches ..0 run function isqrttest:isqrt/merge_8
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# block: loop_check_3
|
|
2
|
+
scoreboard players set $l rs 0
|
|
3
|
+
execute if score $j rs < $d rs run scoreboard players set $l rs 1
|
|
4
|
+
execute if score $l rs matches 1.. run function isqrttest:isqrt/loop_body_4
|
|
5
|
+
execute if score $l rs matches ..0 run function isqrttest:isqrt/loop_exit_5
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# block: entry
|
|
2
|
+
scoreboard players operation $e rs = $f rs
|
|
3
|
+
scoreboard players operation $e rs = $g rs
|
|
4
|
+
scoreboard players set $h rs 0
|
|
5
|
+
execute if score $g rs <= $a rs run scoreboard players set $h rs 1
|
|
6
|
+
execute if score $h rs matches 1.. run function isqrttest:isqrt/then_0
|
|
7
|
+
execute if score $h rs matches ..0 run function isqrttest:isqrt/merge_2
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# block: entry
|
|
2
|
+
scoreboard players operation $b rs = $c rs
|
|
3
|
+
scoreboard players set $d rs 0
|
|
4
|
+
execute if score $b rs < $a rs run scoreboard players set $d rs 1
|
|
5
|
+
execute if score $d rs matches 1.. run function mathtest:abs/then_0
|
|
6
|
+
execute if score $d rs matches ..0 run function mathtest:abs/merge_2
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# RedScript runtime init
|
|
2
|
+
scoreboard objectives add rs dummy
|
|
3
|
+
scoreboard players set $a rs 0
|
|
4
|
+
scoreboard players set $b rs 1
|
|
5
|
+
scoreboard players set $c rs 2
|
|
6
|
+
scoreboard players set $d rs 45
|
|
7
|
+
scoreboard players set $e rs 90
|
|
8
|
+
scoreboard players set $f rs 180
|
|
9
|
+
scoreboard players set $g rs 270
|
|
10
|
+
scoreboard players set $h rs 360
|
|
11
|
+
scoreboard players set $i rs 1000
|
|
12
|
+
scoreboard players set $j rs 46340
|
|
13
|
+
function mypack:_atan_init
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
# block: entry
|
|
2
|
+
data modify storage math:tables tan set value [0, 17, 35, 52, 70, 87, 105, 123, 141, 158, 176, 194, 213, 231, 249, 268, 287, 306, 325, 344, 364, 384, 404, 424, 445, 466, 488, 510, 532, 554, 577, 601, 625, 649, 675, 700, 727, 754, 781, 810, 839, 869, 900, 933, 966, 1000]
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# block: entry
|
|
2
|
+
scoreboard players operation $o rs = $n rs
|
|
3
|
+
scoreboard players set $p rs 0
|
|
4
|
+
execute if score $o rs < $a rs run scoreboard players set $p rs 1
|
|
5
|
+
execute if score $p rs matches 1.. run function mypack:abs/then_0
|
|
6
|
+
execute if score $p rs matches ..0 run function mypack:abs/merge_2
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# block: loop_body_31
|
|
2
|
+
scoreboard players operation $ao rs = $al rs
|
|
3
|
+
scoreboard players operation $ao rs += $am rs
|
|
4
|
+
scoreboard players operation $ap rs = $ao rs
|
|
5
|
+
scoreboard players operation $ap rs += $b rs
|
|
6
|
+
scoreboard players operation $aq rs = $ap rs
|
|
7
|
+
scoreboard players operation $aq rs /= $c rs
|
|
8
|
+
scoreboard players operation $ar rs = $aq rs
|
|
9
|
+
execute store result storage rs:heap __sgi_0 int 1 run scoreboard players get $ar rs
|
|
10
|
+
function mypack:atan2_fixed/__sgi_1 with storage rs:heap
|
|
11
|
+
scoreboard players operation $as rs = $s rs
|
|
12
|
+
scoreboard players operation $at rs = $s rs
|
|
13
|
+
scoreboard players operation $at rs *= $aa rs
|
|
14
|
+
scoreboard players operation $au rs = $ad rs
|
|
15
|
+
scoreboard players operation $au rs *= $i rs
|
|
16
|
+
scoreboard players set $av rs 0
|
|
17
|
+
execute if score $at rs > $au rs run scoreboard players set $av rs 1
|
|
18
|
+
execute if score $av rs matches 1.. run function mypack:atan2_fixed/then_33
|
|
19
|
+
execute if score $av rs matches ..0 run function mypack:atan2_fixed/else_34
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# block: loop_check_30
|
|
2
|
+
scoreboard players set $an rs 0
|
|
3
|
+
execute if score $al rs < $am rs run scoreboard players set $an rs 1
|
|
4
|
+
execute if score $an rs matches 1.. run function mypack:atan2_fixed/loop_body_31
|
|
5
|
+
execute if score $an rs matches ..0 run function mypack:atan2_fixed/loop_exit_32
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# block: loop_exit_32
|
|
2
|
+
scoreboard players operation $ax rs = $al rs
|
|
3
|
+
scoreboard players set $ay rs 0
|
|
4
|
+
execute if score $ai rs = $b rs run scoreboard players set $ay rs 1
|
|
5
|
+
execute if score $ay rs matches 1.. run function mypack:atan2_fixed/then_36
|
|
6
|
+
execute if score $ay rs matches ..0 run function mypack:atan2_fixed/merge_38
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# block: merge_11
|
|
2
|
+
scoreboard players operation $aa rs = $o rs
|
|
3
|
+
scoreboard players set $ab rs 0
|
|
4
|
+
execute if score $o rs < $a rs run scoreboard players set $ab rs 1
|
|
5
|
+
execute if score $ab rs matches 1.. run function mypack:atan2_fixed/then_15
|
|
6
|
+
execute if score $ab rs matches ..0 run function mypack:atan2_fixed/merge_17
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# block: merge_17
|
|
2
|
+
scoreboard players operation $ad rs = $u rs
|
|
3
|
+
scoreboard players set $ae rs 0
|
|
4
|
+
execute if score $u rs < $a rs run scoreboard players set $ae rs 1
|
|
5
|
+
execute if score $ae rs matches 1.. run function mypack:atan2_fixed/then_18
|
|
6
|
+
execute if score $ae rs matches ..0 run function mypack:atan2_fixed/merge_20
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# block: merge_20
|
|
2
|
+
scoreboard players set $ag rs 0
|
|
3
|
+
execute if score $aa rs > $j rs run scoreboard players set $ag rs 1
|
|
4
|
+
execute if score $ag rs matches 1.. run function mypack:atan2_fixed/then_21
|
|
5
|
+
execute if score $ag rs matches ..0 run function mypack:atan2_fixed/merge_23
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# block: merge_23
|
|
2
|
+
scoreboard players set $ah rs 0
|
|
3
|
+
execute if score $ad rs > $j rs run scoreboard players set $ah rs 1
|
|
4
|
+
execute if score $ah rs matches 1.. run function mypack:atan2_fixed/then_24
|
|
5
|
+
execute if score $ah rs matches ..0 run function mypack:atan2_fixed/merge_26
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# block: merge_26
|
|
2
|
+
scoreboard players set $ai rs 0
|
|
3
|
+
scoreboard players set $aj rs 0
|
|
4
|
+
execute if score $ad rs > $aa rs run scoreboard players set $aj rs 1
|
|
5
|
+
execute if score $aj rs matches 1.. run function mypack:atan2_fixed/then_27
|
|
6
|
+
execute if score $aj rs matches ..0 run function mypack:atan2_fixed/merge_29
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# block: merge_38
|
|
2
|
+
scoreboard players set $ba rs 0
|
|
3
|
+
execute if score $o rs > $a rs run scoreboard players set $ba rs 1
|
|
4
|
+
execute if score $ba rs matches 1.. run function mypack:atan2_fixed/then_39
|
|
5
|
+
execute if score $ba rs matches ..0 run function mypack:atan2_fixed/merge_41
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# block: merge_41
|
|
2
|
+
scoreboard players set $bd rs 0
|
|
3
|
+
execute if score $u rs >= $a rs run scoreboard players set $bd rs 1
|
|
4
|
+
execute if score $bd rs matches 1.. run function mypack:atan2_fixed/then_45
|
|
5
|
+
execute if score $bd rs matches ..0 run function mypack:atan2_fixed/merge_47
|