Skip to content

locka99/DeckOfCards

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is an implementation of a deck of cards written in Java and released under
the LGPLv3. This code forms the core of the ad-supported Android application
ShuffleBot which calculates Texas Hold 'Em odds. 

ShuffleBot runs hundreds / thousands of game simulations on mobile devices
so implementation of a deck is geared towards optimal performance while
maintaining a simple programming API. 

See the COPYING file for more information about LGPLv3.

DeckOfCards project home:

https://github.com/locka99/DeckOfCards

For info about ShuffleBot see here:

https://market.android.com/details?id=com.shufflebot
http://www.shufflebot.com/

For development musings related to DeckOfCards and ShuffleBot subscribe to this feed:

https://joindiaspora.com/tags/shufflebot

Primary classes:

Deck        Represents a deck which consists of 52 cards which are drawn or
            undrawn or some combination of the two.
Card        A card within a deck. Note cards are immutable and only 52 ever exist 
            irrespective of the number of references to them.
CardPattern A wildcard that represent one or more cards based on a pattern.
CardSuit    The suit of a card
CardValue   The value of a card.
Random      A random number generator. It utlitises either the standard Java RNG or
            a secure RNG depending on how it is called.


Build instructions:

You build using Maven like so:

mvn clean install

Add DeckOfCards to another project by including a dependency on this POM, e.g. 

<dependency>
  <groupId>com.adamlock</groupId>
  <artifactId>DeckOfCards</artifactId>
  <version>1.0-SNAPSHOT</version>
</dependency>


For use in GWT, import the DeckOfCards project into your build and add this line to your module:

<inherits name="com.adamlock.DeckOfCards" />


Using it:

Deck deck = new Deck();
deck.shuffle();
Card []cards = deck.deal(5);
for (Card card : cards) {
   System.out.println("You dealt " + card);
}

About

A set of classes that efficiently simulate a deck of cards

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages