Created
May 6, 2023 00:47
-
-
Save martin-martin/1008796754d42ec2487874529304803f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
def create_deck(): | |
RANKS = '2 3 4 5 6 7 8 9 10 J Q K A'.split() | |
SUITS = '♣ ♢ ♡ ♠'.split() | |
return np.array([r + s for s in SUITS for r in RANKS]) | |
print(create_deck()) | |
# ['2♣' '3♣' '4♣' '5♣' '6♣' '7♣' '8♣' '9♣' '10♣' 'J♣' 'Q♣' 'K♣' 'A♣' '2♢' | |
# '3♢' '4♢' '5♢' '6♢' '7♢' '8♢' '9♢' '10♢' 'J♢' 'Q♢' 'K♢' 'A♢' '2♡' '3♡' | |
# '4♡' '5♡' '6♡' '7♡' '8♡' '9♡' '10♡' 'J♡' 'Q♡' 'K♡' 'A♡' '2♠' '3♠' '4♠' | |
# '5♠' '6♠' '7♠' '8♠' '9♠' '10♠' 'J♠' 'Q♠' 'K♠' 'A♠'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Or, if this is too overwhelming, you could make a selection of cards first. For example, the Austrian card game called Schnapsen is played with only 10 J Q K A:
With this deck, you'd (nearly) be back to the amount of elements that you're using in your examples, but it adds a bit of real-world meaning to it.