Recent

Author Topic: Object Pascal Playing Cards Framewrok  (Read 1504 times)

Gustavo 'Gus' Carreno

  • Hero Member
  • *****
  • Posts: 1337
  • Professional amateur ;-P
Object Pascal Playing Cards Framewrok
« on: July 12, 2025, 12:15:31 pm »
Hey Y'All,

In a conversation on the Delphi Community Discord server, a possible new coding challenge was hinted at...
The latest one was sponsored by Darian Miller, and it was to build a Mine Sweeper game.
On the subject of games, Solitaire was brought up.

To the end of providing a common starting point for a possible Solitaire code challenge, I decided to create a card framework.

At the moment we have:
  • Base classes for Card and Deck.
  • Specific classes for the French deck, aka The Standard Deck, with Jokers.
  • A class that implements a card pile.
  • A class that implements a stack of moved cards, in order to enable undo
  • GUI and CLI testing suites
  • A very simple implementation of a Klondike Solitaire, under the examples folder. Very basic!!
  • The inclusion of compiled examples in archives per platform, for each release

You can find the GitHub repo here: objpas-card-framewok.
The repo is at release v0.0.2, containing archives with compiled examples for: Windows, Linux and Darwin.

I welcome any opinions, advice or PR to help improve the current state of things !!

Big thanks in advance to those who do!!

Cheers,
Gus

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12593
  • FPC developer.
Re: Object Pascal Playing Cards Framewrok
« Reply #1 on: July 12, 2025, 01:18:16 pm »
MS Hearts would also be doable. It has the basic trick system and if I put "mshearts rules" in google the AI seems to be fairly complete.

The difficult trick would be to supply some form of AI/autoplay for 3 computer players.

Gustavo 'Gus' Carreno

  • Hero Member
  • *****
  • Posts: 1337
  • Professional amateur ;-P
Re: Object Pascal Playing Cards Framewrok
« Reply #2 on: July 12, 2025, 01:34:45 pm »
Hey Marco,

MS Hearts would also be doable. It has the basic trick system and if I put "mshearts rules" in google the AI seems to be fairly complete.

Nice to know !! Thanks !!

The difficult trick would be to supply some form of AI/autoplay for 3 computer players.

The objective of the card framework is to be as generic as possible. The context of rules and AI/autoplay is outside of the framework's goals.

I can add a sections called Algorithms and Resources to the README.md in order to bootstrap some devs. But I'm not planning on much more in terms of Card packs and rules.
Marco: I would deeply appreciate that you send me some links in that regard!! Many thanks in advance!!

I'll add those sections after some rest. It's the middle of a heat wave here in the UK and my brain is just not working for code :D

Cheers,
Gus

Thaddy

  • Hero Member
  • *****
  • Posts: 18681
  • Jungle wars. And failing health it seems.
Re: Object Pascal Playing Cards Framewrok
« Reply #3 on: July 12, 2025, 02:34:12 pm »
Pity my Windows doesn't include card32.dll anymore.
In Delphi 2 times - so over 28 years ago I wrote 3 games with it:
- Toepen
- Rotterdams klaverjassen.
- Amsterdams klaverjassen.
They are Dutch games.
The last two are very old and in many ways precursors to Bridge, just like the related Whist is in England.
They are all originally naval card games.
« Last Edit: July 12, 2025, 02:35:53 pm by Thaddy »
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12593
  • FPC developer.
Re: Object Pascal Playing Cards Framewrok
« Reply #4 on: July 12, 2025, 02:53:25 pm »
- Toepen
- Rotterdams klaverjassen.
- Amsterdams klaverjassen.

MS Hearts is pretty close to "Schoppen Mieën" (refering to the queen of spades) which is a sub game of Brabantian "Rikken", and like all trick based games are probably derived from Whist or a precursor. 

Schoppen Mieën is played when nobody bids during the bidding phase. Only differences are the direction changes and in "Schoppen Mieën" also the player that "wins" the last trick gets a penalty (equal to the one of getting the queen of spades).

 

TinyPortal © 2005-2018