Library to handle a deck of cards
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1.1 KiB

Building an Interface for the Deckhandler

The interface is written in SWIG. Although these instructions are for building a python wrapper, SWIG supports building interfaces for many other languages.

To build the wrapper for python, from 'builddir':

meson configure -Dswig_lang=python

The resulting files will be in 'swig'.

After creating the wrapper, you can run it as so in python (note: make sure you launch your python console in the same directory as you built the wrapper into, or modify your sys.path to point to the wrapper's directory):

import deckhandler

# Set a seed.

# Create a deck.
deck = deckhandler.st_deck_dh()

# Initialise the deck.

# Shuffle the deck.

# Print out the whole deck.
for i in range(deckhandler.CARDS_IN_DECK):
    card = deckhandler.deck_dh_get(deck, i)
    print("face: {}, suit: {}".format(deckhandler.get_card_face(card), deckhandler.get_card_suit(card)))