Skip to content

J0hnZMT/gdeck

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gdeck

Machine Problem: Cards

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

First you need to install the gdeck package to use as a module

To install using pip

pip install gdeck

To install using pipenv

pipenv install gdeck

Running the tests

To test the module you can run any of the following:

using pytest command

pytest --cov=gdeck

using py.test command

py.test --cov=gdeck

running any test file in the directory

python -m pytest --cov=gdeck

To Use

import the gdeck module then instantiate the Card or Deck class to use

Example:

import gdeck

# To use the Card
rank = 5
suit = Hearts

card = gdeck.Card(rank, suit)
#You can only use the four suits in the deck of cards 'Hearts', 'Clubs', 'Diamonds' or 'Spades'

#To use the Deck
deck = gdeck.Deck()

# to display the 52 cards in the deck
deck.show()

# to display only n number of cards
deck.show(5)#this will print only 5 sets of cards

#you can also shuffle the deck
deck.shuffle()#this will only shuffle the deck but will not display the cards

#you can also draw the first card on the deck
deck.draw_top()#this will draw the first card on the deck

#you can also draw any random card on the deck
deck.choice()#this will draw 1 any random card
deck.choice(5)#this will draw 5 any random card

#you can also use slicing to get a set of cards from the deck
deck[0:52]#this will display all the cards on the deck
deck[0:10]#this will display only the first 10 cards on the deck

--the Deck is also an iterator so you can use it on next() function or in random() function

Author

Johnzel Tuddao - Initial work - J0hnZMT

License

This project is licensed under the MIT License - see the LICENSE.md file for details

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages