Commit 130a357
chore: finalize flying_ninja migration to icp-cli (Motoko + Rust) (#1374)
* chore: finalize motoko/flying_ninja migration to icp-cli
Upgrades icp.yaml to motoko@v5.0.0 and asset-canister@v2.2.1, updates
mops.toml toolchain to moc 1.9.0 / core 2.5.0 with correct args format,
removes dfx fallbacks from vite.config.js and actor.js, adds Makefile
with tests for all public functions, adds CI workflow, rewrites README,
and deletes dfx.json, BUILD.md, and .devcontainer/.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: migrate rust/flying_ninja to icp-cli; bump icp-dev-env to 0.3.2
- Bump @dfinity/asset-canister v2.1.0 → v2.2.1
- Bump ic-cdk 0.16 → 0.20, candid 0.10.10 → 0.10
- Add Makefile with 4 tests
- Delete dfx.json, BUILD.md
- Bump both container images to icp-dev-env 0.3.2
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* revert: back to icp-dev-env 0.3.1 (0.3.2 not yet on ghcr.io)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* chore: bump icp-dev-env to 0.3.2 (images now published)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix: replace removed ic_cdk::api::management_canister with ic_cdk::call for raw_rand
ic_cdk::api::management_canister was removed in ic-cdk 0.17+.
Use ic_cdk::call(Principal::management_canister(), "raw_rand", ()) instead.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix: use ic_cdk::management_canister::raw_rand() (ic-cdk 0.20 API)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix: use ic-cdk-management-canister crate for raw_rand
ic_cdk::management_canister was removed — the canonical approach is the
dedicated ic-cdk-management-canister = "0.1.1" crate.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* docs: add ic-mops prerequisite
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* docs(rust/flying_ninja): rewrite README to match Motoko style
Remove dfx/BUILD.md references, add make test step, fix docs URL,
clarify the Rust backend in the intro.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(flying_ninja): use refs in game loop to prevent double-scoring in dev
React 18 StrictMode double-invokes effects in development. The game
loop useEffect had frame-level state (ninjaY, ninjaVelocity, pipeX,
gapPosition) in its dep array, causing the interval to be recreated
every 30ms tick. This created a window where two intervals ran
simultaneously, incrementing the score by 2 per gate instead of 1.
Fix: use useRef for all mutable game state read inside the interval,
reduce the dep array to [gameState, rng], and sync refs alongside
state setters. Also fixes a keypress listener leak where the inline
arrow function on line 103 was never removed on cleanup.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* test(flying_ninja): use score 0 in is_high_score test to clarify intent
Score 0 makes it clear that any value qualifies when the leaderboard
has fewer than 10 entries — the logic is about capacity, not the score.
Update description accordingly.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 25af8bc commit 130a357
21 files changed
Lines changed: 239 additions & 328 deletions
File tree
- .github/workflows
- motoko/flying_ninja
- .devcontainer
- backend
- frontend
- src
- rust/flying_ninja
- .devcontainer
- backend
- frontend/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
| 3 | + | |
16 | 4 | | |
17 | 5 | | |
18 | 6 | | |
19 | 7 | | |
20 | 8 | | |
21 | | - | |
22 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
23 | 12 | | |
24 | 13 | | |
25 | 14 | | |
26 | | - | |
27 | | - | |
28 | 15 | | |
29 | 16 | | |
30 | 17 | | |
31 | 18 | | |
32 | 19 | | |
33 | | - | |
34 | | - | |
35 | | - | |
| 20 | + | |
36 | 21 | | |
37 | 22 | | |
38 | 23 | | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | 24 | | |
| 25 | + | |
| 26 | + | |
45 | 27 | | |
46 | 28 | | |
47 | | - | |
| 29 | + | |
48 | 30 | | |
49 | 31 | | |
50 | | - | |
| 32 | + | |
51 | 33 | | |
52 | 34 | | |
53 | 35 | | |
| |||
57 | 39 | | |
58 | 40 | | |
59 | 41 | | |
60 | | - | |
| 42 | + | |
61 | 43 | | |
62 | 44 | | |
63 | 45 | | |
64 | 46 | | |
65 | | - | |
| 47 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
43 | 42 | | |
44 | 43 | | |
45 | 44 | | |
| |||
49 | 48 | | |
50 | 49 | | |
51 | 50 | | |
52 | | - | |
53 | 51 | | |
54 | 52 | | |
55 | 53 | | |
56 | | - | |
57 | 54 | | |
58 | | - | |
59 | 55 | | |
60 | 56 | | |
61 | | - | |
62 | | - | |
63 | 57 | | |
64 | 58 | | |
65 | 59 | | |
| |||
78 | 72 | | |
79 | 73 | | |
80 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
81 | 86 | | |
82 | | - | |
83 | 87 | | |
84 | 88 | | |
85 | 89 | | |
86 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
87 | 96 | | |
88 | 97 | | |
89 | 98 | | |
| |||
92 | 101 | | |
93 | 102 | | |
94 | 103 | | |
95 | | - | |
96 | 104 | | |
97 | 105 | | |
98 | 106 | | |
| 107 | + | |
99 | 108 | | |
100 | 109 | | |
101 | 110 | | |
102 | 111 | | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
| 112 | + | |
109 | 113 | | |
110 | 114 | | |
111 | 115 | | |
| |||
121 | 125 | | |
122 | 126 | | |
123 | 127 | | |
124 | | - | |
125 | | - | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
126 | 132 | | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
136 | 149 | | |
137 | 150 | | |
138 | 151 | | |
139 | | - | |
140 | | - | |
141 | | - | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
142 | 158 | | |
143 | 159 | | |
144 | 160 | | |
| |||
147 | 163 | | |
148 | 164 | | |
149 | 165 | | |
150 | | - | |
| 166 | + | |
151 | 167 | | |
152 | 168 | | |
153 | | - | |
| 169 | + | |
154 | 170 | | |
155 | 171 | | |
156 | 172 | | |
| |||
159 | 175 | | |
160 | 176 | | |
161 | 177 | | |
162 | | - | |
| 178 | + | |
163 | 179 | | |
164 | 180 | | |
165 | | - | |
| 181 | + | |
166 | 182 | | |
167 | 183 | | |
168 | 184 | | |
| |||
0 commit comments