badcards 0.2.3 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +52 -0
- data/lib/badcards/card.rb +2 -2
- data/lib/badcards/deck.rb +6 -2
- data/lib/badcards/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89fc14a4fc5e0a46a7f8be3555bee622dd5d84df
|
4
|
+
data.tar.gz: 5e225d4f3469c8d8b26c3009d4bc8db24c20da80
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da6eb1534c4bf7a28623de6303f77f7ee17925ee0843f1793e7a8f88f89e17b237285eae1ac4da5bf9da47a6d09ca36dccffd44d8220e2ab6488a23e54a70cee
|
7
|
+
data.tar.gz: 3002e00a023841691af2903c7f4275ea4009e3f5520353875a7e920866e93d0dd7e4ac0bd38cab6a5cae931b6732f84594a0c06bd6e7b7679cb750f9a001c3ed
|
data/README.md
CHANGED
@@ -4,6 +4,8 @@
|
|
4
4
|
[](https://coveralls.io/r/BensPotatoes/BaDCards?branch=master)
|
5
5
|
|
6
6
|
Ruby library of playing cards.
|
7
|
+
I needed a card library for an app so I decided to make one.
|
8
|
+
Why "badcards"? Because the images are bad (check them out, you'll see what I mean).
|
7
9
|
|
8
10
|
## Installation
|
9
11
|
|
@@ -27,6 +29,56 @@ hand = Hand.new # create a hand that can hold onto cards
|
|
27
29
|
deck = Deck.new(6) # create a deck consisting of six mini-decks of 52 cards
|
28
30
|
```
|
29
31
|
|
32
|
+
## Properties
|
33
|
+
|
34
|
+
### Card
|
35
|
+
A card has a value, suit, and image.
|
36
|
+
Images are hosted by myself on S3 and (for the moment) are publicly available.
|
37
|
+
|
38
|
+
```
|
39
|
+
card = Card.new("Ace", "Spades")
|
40
|
+
card.img
|
41
|
+
# => "https://s3-us-west-2.amazonaws.com/badcards/cards/spade/ace.png"
|
42
|
+
```
|
43
|
+
|
44
|
+
Acceptable values (as strings):
|
45
|
+
|
46
|
+
* Ace (A)
|
47
|
+
* 2
|
48
|
+
* 3
|
49
|
+
* 4
|
50
|
+
* 5
|
51
|
+
* 6
|
52
|
+
* 7
|
53
|
+
* 8
|
54
|
+
* 9
|
55
|
+
* 10
|
56
|
+
* Jack (J)
|
57
|
+
* Queen (Q)
|
58
|
+
* King (K)
|
59
|
+
|
60
|
+
Acceptable suits (as strings):
|
61
|
+
|
62
|
+
* Diamond (D)
|
63
|
+
* Club (C)
|
64
|
+
* Heart (H)
|
65
|
+
* Spade (S)
|
66
|
+
|
67
|
+
### Hand
|
68
|
+
A simple container to hold cards, currently no limit on the number of cards in each
|
69
|
+
|
70
|
+
### Deck
|
71
|
+
A deck is comprised of a minimum of 52 cards, currently no limit on the number of base decks in each (defaults to 1).
|
72
|
+
Has a shuffle method to shuffle cards randomly, shuffles 12 times by default.
|
73
|
+
Also has a peek method to see what the n top-most cards are.
|
74
|
+
|
75
|
+
```
|
76
|
+
deck = Deck.new(6)
|
77
|
+
deck.shuffle(3)
|
78
|
+
deck.peek(5)
|
79
|
+
# => [Card, Card, Card, Card, Card]
|
80
|
+
```
|
81
|
+
|
30
82
|
## Contributing
|
31
83
|
|
32
84
|
1. Fork it ( http://github.com/benspotatoes/badcards/fork )
|
data/lib/badcards/card.rb
CHANGED
data/lib/badcards/deck.rb
CHANGED
data/lib/badcards/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: badcards
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benjamin Hsieh, Ben's Potatoes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|