Giter Site home page Giter Site logo

cards's Introduction

about

cards is python 3 module that simulates a deck of cards. It's main feature is realShuffle() which attempts to simulate human shuffling. It is available under the MIT License.

usage

to create a Deck:

from cards import Deck, Card

deck = Deck() #creates a new standard Deck
#or
deck = Deck(cards=tuple_of_cards) #creates a deck from a Card array

to create a card:

from cards import Card

card = Card(Card.ACE,Card.SPADES)
#or
card = Card(2,Card.SPADES)

for more, check out the wiki

realShuffle()

realshuffle() tries to simulate a riffle shuffle

realShuffle() uses 3 constants:

CUT_ERROR = 10
SHUFFLE_START_ERROR = 4
SHUFFLE_ERROR = 1

CUT_ERROR: this is how far from the middle the deck it cut. 3 ±randoms are averaged for the used result.

SHUFFLE_START_ERROR: this is how many cards can be dropped initially. it is a random range.

SHUFFLE_ERROR: this is how many cards are dropped each time. a random between 1 and SHUFFLE_ERROR+1.

cards's People

Contributors

petelliott avatar jacobrec avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.