Okay the title may be a little confusing, but here's what I'm trying to do :) I have a game in XNA where every tap from the user draws a moving circle on the screen. The circle has a tag, say 'dogs' displayed on it. So imagine multiple taps on the screen, and we have all these circles of various colors and sizes moving around the screen with different (but constant) velocities. Each circle with different tags: 'dogs', 'cats' and so on...
Clicking on empty space generates a new circle at that point. Clicking on one of the circles "selects" it, turning it into a greeen shade and slowing its velocity down to a fraction of what it was. Clicking on it again "unselects" it, and restores its original color and velocity (trajectory does not change).
With each circle comes a tag, and as of now I'm populating these tags randomly from a string array (which means there's a chance tags will repeat). I would like the tags for newly created circles to be relevant to previous "selected" tags. So when I click on 'dogs', I would like 'German Shepherd' but I would also like 'dog parks' and 'lemurs' assuming dogs get along well with lemurs.
What would be the best way to approach this problem. In my head I have a massive many-to-many mapping, but I can't seem to translate it to code. Thanks for looking.
FYI I'm using the sample project from here: http://mobile.tutsplus.com/tutorials/windows/introduction-to-xna-on-windows-phone-7/
preguntado el 08 de enero de 11 a las 22:01
At a glance your data structure sounds like a tree, except each node has a list of parents instead of a single parent. You could describe it as many to many like you said, but there's likely more links in the child direction than the parent direction.
Alternatively you could leave it as a tree structure and add a list of associations to nodes, so that like you say lemurs and dogs can be associated, even though they are not in a parent / child relationship.