https://scratch.mit.edu/discuss/post/8056345/ の想定解答です。
https://scratch.mit.edu/projects/1048807914/ 改良版です。