- Home /
Poker Game ... Distribute Card
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
And here's me thinking this question was going to be on the latest research in AI for texas hold 'em.
Answer by Mizuho · Jun 24, 2012 at 04:17 AM
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[i];
a++;
}
}
return newArray;
}
Edit: If you don't need compatibility for ancient .NET versions, just use a List instead.
@$$anonymous$$izuho - I have just one thing to say: List ;)
@whydoidoit: The guy I'm working for told me not to use lists when I started, so I have arrays linked to my brain at the moment. Lists would probably be a good a idea for this guy (as long as he doesn't want FULL compatibility for ancient versions).
if you like, I will telephone the "guy you are working for" and straighten him out.
@$$anonymous$$izuho - Don't use List :) Wow - next he'll be telling you to not drink water...
Answer by hesa2020 · Jun 24, 2012 at 04:49 AM
Well i just realized while reading back , not gonna use c# but PHP cuz i want to give card from server side.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
C# Random Stats Distribuition 3 Answers
Making a bubble level (not a game but work tool) 1 Answer
An OS design issue: File types associated with their appropriate programs 1 Answer