badcards 0.2.3 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e65c8a32d66371c3b2b62a05d6305df0ea9446c9
4
- data.tar.gz: c8dd7c3580ed698e6ab35b62255813e776596764
3
+ metadata.gz: 89fc14a4fc5e0a46a7f8be3555bee622dd5d84df
4
+ data.tar.gz: 5e225d4f3469c8d8b26c3009d4bc8db24c20da80
5
5
  SHA512:
6
- metadata.gz: f8fd2516fb581527bafcf2c06db13472f23e0076643863eee66becc532b5f02eb6c25d9df7b33ae771ce7dc6ab30607df81ec7c00835159354e89d43a84c1a66
7
- data.tar.gz: 7757e906f56989b83827adcc9127ffdf8913f21cf8c409fb8a03eaebbdb290c06e398e009553257d427cc29b7e66804b7389375547e9f2ce7194ddd5bf298bb6
6
+ metadata.gz: da6eb1534c4bf7a28623de6303f77f7ee17925ee0843f1793e7a8f88f89e17b237285eae1ac4da5bf9da47a6d09ca36dccffd44d8220e2ab6488a23e54a70cee
7
+ data.tar.gz: 3002e00a023841691af2903c7f4275ea4009e3f5520353875a7e920866e93d0dd7e4ac0bd38cab6a5cae931b6732f84594a0c06bd6e7b7679cb750f9a001c3ed
data/README.md CHANGED
@@ -4,6 +4,8 @@
4
4
  [![Coverage Status](https://coveralls.io/repos/BensPotatoes/BaDCards/badge.png?branch=master)](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 )
@@ -101,8 +101,8 @@ class Card
101
101
  end
102
102
 
103
103
  def self.all_cards
104
- VALUES.each do |value|
105
- SUITS.each do |suit|
104
+ SUITS.each do |suit|
105
+ VALUES.each do |value|
106
106
  yield value, suit
107
107
  end
108
108
  end
@@ -16,8 +16,12 @@ class Deck
16
16
  @cards.count
17
17
  end
18
18
 
19
- def peek
20
- @cards.first
19
+ def peek(num_to_peek = 1)
20
+ if num_to_peek == 1
21
+ @cards.first
22
+ else
23
+ @cards[0..num_to_peek-1]
24
+ end
21
25
  end
22
26
 
23
27
  def shuffle(num_times = 12)
@@ -1,3 +1,3 @@
1
1
  module Badcards
2
- VERSION = "0.2.3"
2
+ VERSION = "0.3.0"
3
3
  end
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.2.3
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-28 00:00:00.000000000 Z
11
+ date: 2014-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler