[Kde-games-devel] Re: KPoker and the card images

Andreas Beckermann b_mann at gmx.de
Wed Aug 25 23:46:42 CEST 2004


On Wednesday 25 August 2004 23:08, Inge Wallin wrote:
> Hi again,

Hi

> I am now done writing a PokerHand class that handles all aspekts of (guess
> what...) a Poker hand.  This will ultimately be used to fix bug 30272, a
> misevaluation of several different hands.  However, when i tested it, very
> strange things happened.

Well, I told you that I have code for these things already, I just need to go 
to that computer (whether I can do that this week depends on things I can't 
control very much). But if you want to do that work now, then of course you 
can spend your time on problems that are fixed already ;-)

> I traced the problems to the fact that the cards that I thought I had,
> were not the ones that got displayed.  Then I looked at the card decks
> (image files) in libkdegames and got very surprised by the order in which
> they were stored.
>
> Card "1.png" is the Ace of Clubs, "2.png" was the Ace of Spades, and so
> on.  Card "52.png" is two of diamonds.  Some questions:
>
> 1. Why this order for the suits?  The order of the suits, as far as I
> know, clubs, diamonds, spades and hearts in increasing order.

I don't know. Why not? ;-)
I don't think there is a special reason. However it doesn't make much sense to 
argue whether it makes sense or not, because that's the way it is.
Also the "order" of the suits depend entirely on the kind of game you are 
playing. A solitair game will probably use a different order (if any) than a 
poker or a skat game, I guess.

> 2. Why this order of ranks?  Why have the best cards using the lowest
> indices?  Wouldn't the other way around be more intuitive?

Some games use Ace, King, ..., 5, 6, 7 only. Others use all cards, down to 2.
Therefore it makes sense to name them in a way that you can start at one and 
count up to what you need.

> 3. Is this a standard order that is defined anywhere?  If so, where?

Look at your favorite carrddeck. They all use the same numbering.

> 4. Wouldn't some other card classes than just images be a good addition to
> libkdegames?  I have written a few for this project that I can brush up
> and then let you look at and decide if it is a good idea.

We had that idea before, but decided against this, IIRC mainly because every 
game that uses cards provides something like that already anyway and I don't 
see much point in rewriting them so that they all share the same API.

>  -Inge

CU
Andi


More information about the kde-games-devel mailing list