https://github.com/locka99/deckofcards
A set of classes that efficiently simulate a deck of cards
https://github.com/locka99/deckofcards
Last synced: about 1 year ago
JSON representation
A set of classes that efficiently simulate a deck of cards
- Host: GitHub
- URL: https://github.com/locka99/deckofcards
- Owner: locka99
- License: lgpl-3.0
- Created: 2011-08-12T13:50:13.000Z (almost 15 years ago)
- Default Branch: master
- Last Pushed: 2012-03-19T12:58:20.000Z (over 14 years ago)
- Last Synced: 2025-01-30T19:15:00.595Z (over 1 year ago)
- Language: Java
- Homepage:
- Size: 133 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
- License: COPYING
Awesome Lists containing this project
README
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.
com.adamlock
DeckOfCards
1.0-SNAPSHOT
For use in GWT, import the DeckOfCards project into your build and add this line to your module:
Using it:
Deck deck = new Deck();
deck.shuffle();
Card []cards = deck.deal(5);
for (Card card : cards) {
System.out.println("You dealt " + card);
}