algorithm, fixed to avoid double images

When the same image was used twice in the set the activity
was confusing.