Computer Science Canada Poker Help |
Author: | poomanchunk [ Mon Jun 14, 2004 5:55 pm ] | ||
Post subject: | Poker Help | ||
Ok I'm making a casino, and I got alot of stuff to work already. But I can't get poker to work. It's because of 52 cards, and not being able to get the same one twice. Unlike blackjack, I didn't need suits, so it's not bad. I thought poker would be just as easy, but I've been through 3 days of racking my brain trying to figure it out. Finally I just gave up and came here ![]() I know there is a long way to do this... I very long way, which I do not wanna do, unless I have to. (which is somewhat like this)
and so on... As you can see that'll take forever to do. Is there any way I can get it so that you cannot get 2 of the same card, that is relatary short? |
Author: | SuperGenius [ Mon Jun 14, 2004 6:40 pm ] |
Post subject: | |
you do need suits in poker... because a flush and a straight flush have different values, yet the numbers on the cards could be the same. |
Author: | poomanchunk [ Mon Jun 14, 2004 10:27 pm ] |
Post subject: | |
Umm... ya. ? That didn't help me at all I was asking how I could make it so I wouldn't get two of the same cards. I knew I had to make suits, with different numbers. If I didn't I wouldn't asked that! |
Author: | zylum [ Mon Jun 14, 2004 10:54 pm ] | ||
Post subject: | |||
here's a deck generator i mind a while ago... it generates the deck with initDeck and then shuffles it with shuffleDeck...
-zylum |
Author: | SuperGenius [ Tue Jun 15, 2004 8:25 am ] |
Post subject: | Re: Poker Help |
poomanchunk wrote: Unlike blackjack, I didn't need suits, so it's not bad.
sorry if this threw me off a little. |
Author: | beard0 [ Tue Jun 15, 2004 9:46 am ] |
Post subject: | Re: Poker Help |
I think poomanchunk meant: Unlike blackjack, where I didn't need suits, so it wasn't so bad, I need suits in poker. English can be a beautiful thing, when used properly. |
Author: | TheFerret [ Sat Jun 26, 2004 6:44 pm ] | ||
Post subject: | |||
Here is some code to make all cards delt different... This code is from my Euchre game and needs to be modified for poker... hands is a int array from 8..52, cards in suit are 8..13, 21..26, 34..39, 47..52... For your game you have to use all #s and change temp to 1,52 and the part below does not need to be there...
|
Author: | DanShadow [ Mon Jun 28, 2004 1:41 pm ] | ||||
Post subject: | |||||
Well...in my opion, you should make a record array with the name of every card.
Then when you draw a card, you could erase it from the deck like this:
Anyway, I hope this helped in some way... |
Author: | blackwhite [ Sat Jul 03, 2004 12:35 pm ] |
Post subject: | |
What i did when I made my black jack game (to make sure there's no card picked twice), I used an array for "used cards" and used a for loop to set them all to 0. Then when I was dealling out a card, I put it through a conditional loop and used an if statement to make sure that the card's "used card" value isn't 1. if it is, then redeal, if not then set it to one and continue. Edit: Don't forget to include the loop to set them all to 0 in the program loop if the program repeats. |
Author: | zylum [ Sun Jul 04, 2004 12:25 am ] |
Post subject: | |
thats not very efficient in card game programs because once you get to the last card you only have a 1 in 52 chance for the card to come up... |
Author: | cbc [ Wed Jul 07, 2004 8:15 pm ] |
Post subject: | |
cudnt u make a 2 layer array representing a deck? eg: var deck : array 1 .. 4, 1 .. 13 of int so 1 .. 4 is for the 4 diff suits. |
Author: | Delos [ Wed Jul 07, 2004 8:22 pm ] |
Post subject: | |
Yes you could, but that wouldn't make checking for the dealtedness of a card easier... Given, it would make your life easier seeing as you can see your deck a bit easier... |