-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
64 lines (42 loc) · 1.94 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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);
}