Updated Card Games basics

Post your own tutorials, guides and demos.

Post » Sun Jan 04, 2009 8:22 pm

I had some free time today so I started to play with Znirk card-demo.cap and made some updates to it.

Right now I am working on the best way to display the next card so it overlaps the last card so you can see both. But I am having a problem with my for each object coding.

So if anyone has any tips please let me know.

Also,Thanks to
stainsor
for showing were you can get the card graphics
http://www.jfitz.com/cards/ if you don't want to design your own cards. They provide a couple decks to choose from.

Znirk
For the card-demo.cap that that is were most of the base code for this CAP came from.
B
15
S
10
G
8
Posts: 107
Reputation: 4,944

Post » Mon Jan 05, 2009 3:14 am

ok , I got the cards to display right now in rows. But I have some looping problem after you click on "New Deck" or "Shuffle all" Buttons. it does not display the first card right. But all the rest are ok.
If anyone can look at this and see what is the problem that be a big help.
B
15
S
10
G
8
Posts: 107
Reputation: 4,944

Post » Mon Jan 05, 2009 3:27 pm

This is good stuff. I can definitely use this in my card game.

I managed to fix your bug. When the troublesome buttons are clicked I set it's X position to 297. I guess the old Card2 object that was hanging around still had its old position.
B
3
S
2
G
4
Posts: 271
Reputation: 2,017

Post » Mon Jan 05, 2009 4:25 pm

Thanks stainsor for helping me out with the CAP :D

Now the hard part, making the card hand ranking system.
B
15
S
10
G
8
Posts: 107
Reputation: 4,944

Post » Mon Jan 05, 2009 4:42 pm

This is a neat example.

I've given some thought to ranking; I think it's probably easier if it's builtin, and there is a condition such as:

'Hand is stronger than Other Hand', whereby the two hands can be entered using array parameters, like so:

{ 1, 2 }, { 33, 34} would be two hands, where the numbers were the card number in the deck.

There would have to be some options, such as 'ace is low', etc, but I think it'd work out pretty well.
B
3
S
2
G
5
Posts: 1,777
Reputation: 5,529

Post » Mon Jan 05, 2009 5:12 pm

I've also had thoughts about a poker hand ranking system. Each hand would be assigned a numeric value that signifies how powerful it is. Of course the advantage of this system is that you just compare two decimal numbers to see who wins. It would look something like this:

Base Hand Value:
70000 Straight flush
60000 Four of a kind
50000 Full house
40000 Flush
30000 Straight
20000 Three of a kind
10000 Two pair
100 One pair
0 High card

Hand Value Modifier:
* for most hands (high card, pair, three of a kind, straight, four of a kind, straight flush) the modifier would be equal to the highest card in the hand. ex: pair of 9s = 109

* For two pair put the highest pair in the first two digits after the 1 and the low pair in the next two digits. ex: Aces and eights = 11408

* Full house is similar to two pair. ex: Aces full over eights = 51408

Kicker Value:
We also have to rank the kicker in case two people have hands of the same value. (for example if both have a pair of threes.) Put this information in the decimal. Don't forget to use two digits for each card.
ex: the five cards 2 2 3 5 6 rank as 102.060503
B
3
S
2
G
4
Posts: 271
Reputation: 2,017


Return to Your tutorials & example files

Who is online

Users browsing this forum: No registered users and 0 guests