Hi again, more questions regarding best practices for the Pandemic Simulation BJC U5L2 project, I hope this is helpful for others as well as myself!
So the given implementation in the teacher's guide has the sprite drop N clones, and then hide itself, so N+1 exist. When the message is broadcast to step one iteration, the original, hidden sprite also receives that message and runs the (when I receive) hat-block script (I think).
Because of this, I chose drop N-1 clones, and leave the original unhidden, so everybody is involved.
But now I'm trying to write a custom reporter <stable?>, to go through and see if anybody is still contagious. If I loop through (my clones) or (my other clones), I only go through n-1, the original is exempt.
So I could go back to dropping N clones and hiding the original, but I might need to put checks somewhere to prevent the original from running scripts in response to broadcast messages. How do I test "am I a clone" or "am I myself"?
Or I could leave it like this, in which case, for situations where I need to loop through everybody, I guess the best thing to do is loop through (add (my self) to (my clones)) ?
I know this is kind of a picky question where there's not a definitive right answer, what I'm looking for is the path I can lead my students down that will be least likely to land them in a difficult spot
In the parent sprite (not in a clone), you can add (object [myself]) to (my [clones]) to get a list of all the clones and the original sprite. This will have to only run in the main sprite as it'll not work in a clone.
If you want to run it in a clone, and just use (my [other clones]) you'd just add (object [myself]) to (my [other clones]) to get a list of all the clones. Alternatively, you can just ask (my [parent]) for (my [clones]).
Well first of all you can't actually do
That has no effect.
What I take it you both actually meant is to compute
There's no official best practice about how to get a list of a sprite's entire family. But probably you want the parent sprite to keep a list of its children just once, instead of asking for MY CLONES repeatedly, especially in this simulation, in which nobody dies.
OK, thanks, that's a good idea to make a list once and reuse it.
I will be with my class adding more states, including fatality, but the plan is to keep the sprite/clone around with a black costume, and no motion, and no contagion, so a fixed list will work well.