Hi, i want to distribute card to player but not Randomly well :
im going to make Bonus Pack who
increase change to get double,
Change to get a higher card
Chance to get a J and a Q
Chance to get a Q and a K
etc…
And i want to disable a card if have already been distrued
Here the card i want :
13 hearts: 2 3 4 5 6 7 8 9 10 J Q K A
13 diamonds: 2 3 4 5 6 7 8 9 10 J Q K A
13 clubs: 2 3 4 5 6 7 8 9 10 J Q K A
13 spades: 2 3 4 5 6 7 8 9 10 J Q K A
I dont know how i can make a function for that ( by the way my game is online and coded in c# )
If you can help me to developp my function it will be awesome
please dont share the Poker Pack, i dont have enough to afford it currently
If it were me, I would use an array for the deck and one for what has been drawn. Then you don’t have to worry about checking whether the card has been distributed or not (it won’t be in the deck’s array).
Edit: I use this kind of thing to remove value from an array.
public static T[] remove<T>(this T[] array, T obj) { return array.remove<T>(System.Array.IndexOf(array, obj)); }
public static T[] remove<T>(this T[] array, int index) {
T[] newArray = new T[array.Length - 1];
int a = 0;
for(int i = 0; i < array.Length; i++) {
if(i != index) {
newArray[a] = array*;*
a++;*
}*
}*
return newArray;* } Edit: If you don’t need compatibility for ancient .NET versions, just use a List instead.