# Detecting closest clones to eachother

I'm trying to make clones of a sprite be able to detect and report that they are the 2 closest to eachother.
I have tried using the MY neighbor tool but cant seem to make it work. The image attached is what I am trying to achieve.
Any suggestions?

I just made the block! it is in Cool custom blocks!. you can also find the names if the sprites, I show how in the project.

i dont really understand how the closest sprite block is working. Also i think i forgot to mention that the clones are not a fixed amount. I have code before it that makes is so that when u press a button and input a number that amount you inputted will determine the number of clones (all of them randomly locate along the y=-160 line)
This is what i have so far.

I think the my neighbors block takes into account the size of the sprite to determine which sprites are too far away to be neighbors or not. And your sprites are very small.

What I would do is have a script that loops through every other sprite and checks the distance to the sprite. Then you can do some stuff with those distances. You can get the other sprites by using [scratchblocks](my [other sprites v] :: sensing)[/scratchblocks]

is there a way for you to show an example?

This is for the parent detecting closest clone. Replace clones with other clones in the my dropdown for clones to detect the closest of each other.

EDIT: I don't think I have to edit the pic. It should be intuitive enough to know that we

if

we want to detect closest 2 clones.

then get the first and second item of the list reported by that block

I know, I was just asking snapenilk to edit his pic.

Put it inside [scratchblocks] (item (numbers (1) to (2) :: list) of []) [/scratchblocks]. EZPZ.

of course I know that,

Has this been solved yet? if yes, can someone please explain?

the sort block is in the list utilities library

This question is a student assignment so it wouldn't be right to give a complete solution

Thank you very much everyone, I figured out how to solve the issue and it's through a completely different method. And cymplecy is right.

How did you solve this, can you share it with us ?

I went through the graph to find the smallest item and while doing that kept count of the item number and made it report item number

Because it's an assignment, the complete answer shouldn't be shared otherwise other students might just copy it

no one said it was assignment, and 2: @sajjad_sharif you are a whole differrent account, it is confusing me.

i'm pretty sure it is an assignment, i saw someone else earlier ask help on a project which looked very similar to the same as the project this person is working on. in the project it would show two closest clones of an alonzo. the op is asking how to do this. also, the other person said it was an assignment. therefore this is likely the same assignment.