nevatre wrote:I am struggling to understand what you mean. In general, if the 'pack' is composed of N groups with {n1, n2, ..., nN} elements in each group then you will have a pack whose size is S = n1 * ... * nN. (In the cards case N=2, n1=4, n2=13, and S=52). Is that what you mean?
No, if i understood you correctly, no this is not what i mean.
Here is simply what i mean:
A deck contains 52 cards.
Each card holds
2 pieces of information:
1)A number from 1 to 13 for representing the rank(A,2,3,...,Q,K).
2)A number from 1 to 4 for representing the suit (♥,♦,♣,♠).
What i want is to have an object
(i would like an array, e.g A[], to be able to do that but as it seems an array in C can only store
one piece of information i.e a single number(ok we can do some tricks as i've said to make it hold via this single number, 2 numbers so 2 pieces of information but i don't like tricks and i want a general way)
) that can store these 2 pieces of information.
So i would be able to compare them easily, for example if:
A[2]= 4♠ and A[45]= Q♥ with a representation of an 1x2 array like:
A[2] = [4,4] and A[45] = [12,1] i can easily see that A[2] and A[45] cards are not adjacent to each other(the one 4 and the other 5 for example nor have the same suit since the element (1,2) of their array is not the same).
While the A[2]= 4♠ and A[45]= 5♠ with a representation of an 1x2 array like:
A[2] = [4,4] and A[45] = [5,4] i can easily see that A[2] and A[45] cards
are adjacent to each other since 5-4=1(consecutive numbers) and 4-4=0(same suit).
So if cards would hold more information also like:
1)A number from 1 to 13 for representing the rank(A,2,3,...,Q,K).
2)A number from 1 to 4 for representing the suit (♥,♦,♣,♠).
3)A number from 0 to 30 for representing the temperature they have in degrees Celcius.
4)A number from 5 to 10 for representing the weight they have in grams.
So it would be handy if i could represent a card y with a 1x4 array of the kind: A[y] = [12,4,28,6] for saying that this card has the properties:
It's a Q♠ with 28 °C temperature and 6 grams weight.
In order to compare different cards.