Sign in to follow this  
Icebone1000

I need a structure for combination of keys associated with a value..

Recommended Posts

Damn, I cant resolve myself with this...
I have 2 "categories" lets say, one inside another, but depending of the external one, the internal results in a different value...What data structure can I use for this..( Its C#)

Example:

External categories: Frontal, Lateral, Back, Internal
Internal categories: Red, Blue, Yellow, Pink, Black, White

When the active category is Frontal, Red means something, when is Lateral, Red means another thing..Im implementing the categories as enums..
"Something" and "another thing" also are categories @__@... i.e.: Frontal/Red = Visual; Lateral/Red = Economy;

Damn...Im confuse..I also think Visual and Economy would need to be associated with an index on an array, but it would be a different index depending on the categories...not sure..i.e.:
Frontal/Red = Visual.index = 1; Lateral/Blue = Visual.index = 4;
*mind blows*

How can I explain this more concrete..Its a game where the player needs to select the parts of an object(4 parts), this selected part will show 4 options .
Each part selected represent a category of options, but the category isnt always the same for the same selected part, it will change due different cam angles( 4 possible cam angles to choose)..
Means theres a total of 64 options...

Maybe theres an ridiculous easy path between all that mess.

Share this post


Link to post
Share on other sites
Frontal, Lateral, Back, Internal = values 0 -> 3
Red, Blue, Yellow, Pink, Black, White = values -> 0 -> 5

For your data you have an array of (4 * 6) elements. The first 6 elements contain whatever data you want when the primary key is 'frontal', the next 6 when 'lateral' etc.

When you need to find data lookup into the array ((<primary> * 6) + <colour>) to get your index.

For the different camera angles just have an array of the above;

(Vague C# like code)
[code]
List<List<int>> views = new List<List<int>>(4);
for i = 0; i < 4; ++i
views[i] = new List<int>(elementCount)
[/code]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this