Fish Food project glitching

32 views
Skip to first unread message

Sylvia White

unread,
May 11, 2026, 3:57:40 AMMay 11
to Machine Learning for Kids
Hello! I have been working on the fish food project and have trained my model to recognise voices. When I go into Scratch and add the code it works at first, but then stops. It adds the up/down/left code to the food sprite (without me doing anything) and I can't remove it from there. It also sometimes deletes the other coding blocks on the food sprite, and duplicates the up/down code on the fish sprite. Is anyone else having this issue? I have tried restarting different projects and redoing it again and tried on different computers but the same thing keeps happening. :(
Sylvia

Dale Lane

unread,
May 11, 2026, 4:09:25 AMMay 11
to Machine Learning for Kids
I'm not familiar with this project, but I'll help if I can. 

Can you help me to understand the problem you're having, please? 

> ... it works at first, but then stops.

Do you mean the project stops? 

Or the project is still running, but it's not doing what you expected / wanted? 

> It adds the up/down/left code to the food sprite (without me doing anything)

When you say "It" - what is the "It" in this case? 

What code is it adding? 

Can you share an sb3 project file? or a screenshot? or a video recording of the code being added? 

> I can't remove it 

Do you mean you can't delete the code blocks? 

How did you try to do that? What happened when you tried?


Anything you can share to let me understand what you're seeing would be a big help. 

Kind regards

D

Fiero Code Club

unread,
May 15, 2026, 3:08:14 PMMay 15
to Machine Learning for Kids
Hi Dale,

Thanks for your reply.  So the project is one on the Raspberry Pi site:

 fish food image.png

I added all the code as instructed on the project page, after training the model to recognise my voice.
 fish food code.png
The fish responds to my voice at first, moving up and down, left and right as directed. But then on scratch after trying to add the code to the food sprite and running the program a second time or third time (by clicking again on the green flag) blocks of code are randomly deleted or replicated when I switch between sprites. It is not possible to remove the additional code as you normally would, if you click on them and try to drag them off they don't move. Also right clicking and trying to delete also does not work. I'm not sure why this is happening.

Here for example I am trying to delete blocks that have been randomly added to the food sprite. I added them to the fish sprite, as directed, but then they also randomly appeared in the food sprite coding area as well. This makes the game not work.
 can't delete.png
And this is the code all duplicated on top of each other on the fish sprite. Again this just happened randomly. I didn't notice it appear, but it was there when I clicked back to the fish sprite from the food sprite.
duplicated code.png
I've been using Scratch for a while but not seen anything like this before. 

This is the link to the instructions for the game that I have been using. Maybe you can try it and see if you are able to figure out why this is happening!

 We are running a code club and have been using the Raspberry Pi tutorials successfully with our group up till now. Some of them wanted to try these AI machine learning projects but we have run into this problem and can't find a way around it. Any help appreciated!

Thanks,
Sylvia

Dale Lane

unread,
May 17, 2026, 1:21:33 PMMay 17
to Machine Learning for Kids
Sorry for the hassle this has caused you

I've spent a fair chunk of today trying to reproduce this, and I can't. I've built the Fish Food project from scratch (pun very much intended) several times, and it's worked fine every time. I also tried to find timing or edge-case issues to intentionally cause the problem — e.g. flipping between sprites repeatedly while the project was in various states (model running, model not running, after loading from a file, after saving to a file, etc.) and still couldn't see the problem. I've also walked carefully through the relevant source code looking for a potential bug, without finding anything obvious.

I absolutely believe you experienced this — the screenshots make it clear something went wrong — I just can't pin down what's causing it from my end.

My best guess, based on your description, is that it might be a visual issue rather than a bug in the project itself. When you switch between sprites in Scratch, it has to clear the canvas and then load it with the blocks for the new sprite. My suspicion is that the blocks you saw appearing on the food sprite weren't actually attached to it — they may have been a visual leftover from the fish sprite's workspace not clearing properly.

It's worth trying this first: clear your browser's cache. This is more than just refreshing the page - it's deleting the saved copy of Scratch that you have, so you can be sure you get the current latest version.
- In Chrome or Edge: press Ctrl+Shift+Delete (or Cmd+Shift+Delete on a Mac), make sure "Cached images and files" is ticked, and click "Clear data"
- In Firefox: same shortcut, then select "Cached Web Content" and clear it
- In Safari: go to Safari > Settings > Advanced, enable the Develop menu, then Develop > Empty Caches
And then refresh the page.

If clearing the cache doesn't help and you still see the problem, I'm willing to dig into this further — I'm not trying to brush it off. But to have any real chance of finding the cause, I'd need two things, please:

1. Browser console logs if you're not sure what the console is, this guide explains how to open it in different browsers: https://balsamiq.com/support/faqs/browser-console/ . If you can open it before reproducing the problem, then copy and paste anything that appears in there, that would be really helpful.

2. Precise steps to reproduce the problem  As specific as possible — what order you're doing things in, at what point it goes wrong, etc. It's possible that you're doing the one thing I didn't think to try!

Sorry again for the trouble, and I hope clearing the cache does the trick.

Dale
Reply all
Reply to author
Forward
0 new messages