Re: Gataxx



On Fri, 2004-01-02 at 09:47, Callum McKenzie wrote:

> Code for drawing cards and a dialog for changing the look of the cards
> are in gdk-card-image. Dnd is not card-specific, it is used in tetravex
> for example, and is a candidate for extraction into the games-support
> library. This hasn't been done.

What I was thinking about was something like this.

You'd have a back end "deck" type, and I say "deck" loosely, because all
sorts of decks, hands and piles are essentially a card-list.

The operations might include:

- Moving x random cards to another deck (dealing cards).
- Moving specific card(s) to another deck (passing cards, eg Hearts,
  discarding, eg Rummy).
- Moving top card to another deck (eg Rummy).
- Initialising a deck with one or more full decks of cards.
- Trashing specific card(s) (discarding, eg Draw Poker).
- Doing analysis:
  o Finding pairs/triples/etc, partial/full flushes/straights etc,
    eg Poker, Rummy.  Wild handling for this.
  o Summing card values eg BlackJack, Rummy, Hearts.
  o Card detection/counting for specific rank/suit eg detecting aces
    (BlackJack).
- Sorting a hand according to some criteria.
- Moving between card and (suit, rank).
- Extracting from a deck based on whether a card matches a suit/rank.

You'd then have front-end widgets that each correspond to a deck, and
they would get automatically updated as the back end changes.

They would need to know what happens upon clicking/double clicking a
card.

They would also support DnD, where they would understand which card(s)
are going from the deck, which card(s) are going to another deck,
whether that's allowed and if so they would update the back end.

You might have the following front end types:

- Pile, Top Card Face Down/All Cards Face Up/Top Cards Face Up.  The
  last two are distinguished only if you start a DnD but don't complete
  it, for the last you should probably do an outline drag.
- Hand
  o Horizontal (eg Poker, Rummy) or Vertical (eg Klondike, Freecell)
  o Can be in various states - All Cards Shown (eg Poker Hand),
    No Cards Shown (Clock Solitaire), Top Card Shown (eg Klondike),
    Some Other Combination (eg BlackJack Dealer Hand, Texas Hold'em
    Flop).

This would basically handle most possibilities, at least one exception
comes to mind (some solitaire games use a pyramid).

> > Is AisleRiot's game definition format suitable for extension to other
> > card games?
> It depends on what you mean by other card games. It is set up quite
> specifically for single-player games (no computer opponent) and
> specifically solitaire style games. The design is very elegant though
> (even if some of the code isn't).

I mean non-solitaire games.  By extension here I mean adding features so
it could support other games, and moving support for it into the card
library.

It's not suprising it would only support solitaire at the moment, given
that to my knowledge there's no need for betting, summing, complex
analysis, rounds, state, and so on.

The question is, would new card games by serving best by:

- extending or forking the Freecell format to support as much as
  possible, perhaps being a complete definition language (bonus points
  if it stays elegant)
- using it for positioning only, perhaps with a small number of
  extensions, and adding lots of code instead
- not using it at all, except for AisleRiot

> > Is this the sort of thing that could be improved by having a list of
> > things people could do?  Is there such a thing already?
> The gnome-games source tree already has a TODO list, but this doesn't
> contain much in the way of refactoring ideas. Making such a list would
> be very useful, do you (or anyone else) want to give it a go ? It
> doesn't have to be comprehensive, any ideas are good ones !

I think my ideas have most been covered already:

- gnome games library
- card game library (see above)
- board game library (see other thread, possibly some of this like
  Minimax might go in the games library, or all this might be one big
  library)

other than not I'm probably not knowledgeable enough to know what needs
to be done.

-- 
         Matthew Tuck: Software Developer & All-Round Nice Guy        
 My Short Autobiography: 1985 Grade Bin Monitor 1990 Class Clown Award
1992 Awarded Most Likely To Spontaneously Combust 1996 Crowned Galactic
         Emperor 1998 Released From Smith Psychiatric Hospital





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]