game_shuffle_cards 1.0.4
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 +7 -0
- data/.gitignore +14 -0
- data/Gemfile +10 -0
- data/LICENSE.txt +22 -0
- data/README.md +123 -0
- data/Rakefile +2 -0
- data/doc/GameShuffleCards/Card.html +622 -0
- data/doc/GameShuffleCards/Game.html +1094 -0
- data/doc/GameShuffleCards/NotEnoughCardsPerPlayersError.html +123 -0
- data/doc/GameShuffleCards/NotEnoughPlayersError.html +123 -0
- data/doc/GameShuffleCards/ToManyCardsPerPlayerError.html +123 -0
- data/doc/GameShuffleCards/ToManyPlayersError.html +123 -0
- data/doc/GameShuffleCards/TooManyCardsDemandedError.html +123 -0
- data/doc/GameShuffleCards/ValidateGame.html +438 -0
- data/doc/GameShuffleCards.html +129 -0
- data/doc/_index.html +198 -0
- data/doc/class_list.html +58 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +339 -0
- data/doc/file.README.html +196 -0
- data/doc/file_list.html +60 -0
- data/doc/frames.html +26 -0
- data/doc/index.html +196 -0
- data/doc/js/app.js +219 -0
- data/doc/js/full_list.js +181 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +159 -0
- data/doc/top-level-namespace.html +131 -0
- data/features/deck_of_cards.feature +58 -0
- data/features/initial_settings.feature +76 -0
- data/features/step_definitions/deck_of_cards_step.rb +21 -0
- data/features/step_definitions/initial_settings_step.rb +44 -0
- data/features/step_definitions/step.rb +2 -0
- data/game_shuffle_cards.gemspec +24 -0
- data/lib/game_shuffle_cards/card.rb +26 -0
- data/lib/game_shuffle_cards/exceptions.rb +9 -0
- data/lib/game_shuffle_cards/game.rb +84 -0
- data/lib/game_shuffle_cards/validate_game.rb +43 -0
- data/lib/game_shuffle_cards/version.rb +5 -0
- data/lib/game_shuffle_cards.rb +2 -0
- metadata +119 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 69e496d0475541daaba81fe2ab6cdb6ec0c740a5
|
|
4
|
+
data.tar.gz: ddb1905099da8999f844ad85169470fef5d65633
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 1943c71ce2ee01d9477eeaf5994961d1ed359af3c198133f918f2b842b2379fb13020dc7b160c8a8b76a3dfd715f7cd1bd8c932f0d0903532fd379c98c08cb7a
|
|
7
|
+
data.tar.gz: b33bf661505491632b880deeb51fe56ddf453af1ed5fec94f6a6400de11c89d42df80ea77dbea86cf060854aa925d7c387911cdf367b4f7e798857b0d6fbe983
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2015 Diego
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# GameShuffleCards
|
|
2
|
+
|
|
3
|
+
A Game to shuffle a deck of cards and presents the result
|
|
4
|
+
With the class Game you can handle a deck of cards and setting the players and the cards per player. And shuffle the deak of cards.
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
|
|
8
|
+
Add this line to your application's Gemfile:
|
|
9
|
+
|
|
10
|
+
```ruby
|
|
11
|
+
gem 'game_shuffle_cards'
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
And then execute:
|
|
15
|
+
|
|
16
|
+
$ bundle
|
|
17
|
+
|
|
18
|
+
Or install it yourself as:
|
|
19
|
+
|
|
20
|
+
$ gem install game_shuffle_cards
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
```ruby
|
|
24
|
+
# create a new game with 5 players and 3 cards per player
|
|
25
|
+
game = Game.new(5,3)
|
|
26
|
+
# to shuffle a deck of cards , 3 cards per player , to 5 players
|
|
27
|
+
game.results
|
|
28
|
+
|
|
29
|
+
{0=>["8 of spades", "Q of clubs", "5 of diamonds", "3 of hearts"], 1=>["9 of spades", "5 of clubs", "9 of clubs", "J of clubs"]}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
If you repeat the `game.result` the deck will go emptying
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
2.2.0 :003 > g.results
|
|
37
|
+
=> {0=>["8 of spades", "Q of clubs", "5 of diamonds", "3 of hearts"], 1=>["9 of spades", "5 of clubs", "9 of clubs", "J of clubs"]}
|
|
38
|
+
2.2.0 :004 > g.results
|
|
39
|
+
=> {0=>["10 of clubs", "A of clubs", "5 of hearts", "4 of spades"], 1=>["Q of diamonds", "2 of hearts", "3 of spades", "8 of clubs"]}
|
|
40
|
+
2.2.0 :005 > g.results
|
|
41
|
+
=> {0=>["6 of clubs", "A of diamonds", "10 of diamonds", "J of hearts"], 1=>["7 of spades", "8 of hearts", "K of diamonds", "4 of clubs"]}
|
|
42
|
+
2.2.0 :006 > g.results
|
|
43
|
+
=> {0=>["Q of hearts", "7 of diamonds", "9 of hearts", "10 of hearts"], 1=>["2 of clubs", "4 of hearts", "4 of diamonds", "7 of clubs"]}
|
|
44
|
+
2.2.0 :007 > g.results
|
|
45
|
+
=> {0=>["5 of spades", "J of spades", "9 of diamonds", "10 of spades"], 1=>["2 of diamonds", "A of hearts", "K of clubs", "3 of diamonds"]}
|
|
46
|
+
2.2.0 :008 > g.results
|
|
47
|
+
=> {0=>["2 of spades", "6 of diamonds", "6 of spades", "K of hearts"], 1=>["A of spades", "3 of clubs", "8 of diamonds", "K of spades"]}
|
|
48
|
+
2.2.0 :009 > g.results
|
|
49
|
+
=> {0=>["J of diamonds", "7 of hearts", "Q of spades", "6 of hearts"], 1=>[]}
|
|
50
|
+
2.2.0 :010 > g.results
|
|
51
|
+
=> {0=>[], 1=>[]}
|
|
52
|
+
```
|
|
53
|
+
If you want to repeat the operation with the same deck, you could instantiate an object again
|
|
54
|
+
|
|
55
|
+
```ruby
|
|
56
|
+
game = Game.new
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
And the deck will be full again.
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
The deck has defined in class Game the constants you can change it to another type of deck.
|
|
63
|
+
By default there are 52 cards: 4 suits and 13 values, they are
|
|
64
|
+
|A of clubs |
|
|
65
|
+
|2 of clubs |
|
|
66
|
+
|3 of clubs |
|
|
67
|
+
|4 of clubs |
|
|
68
|
+
|5 of clubs |
|
|
69
|
+
|6 of clubs |
|
|
70
|
+
|7 of clubs |
|
|
71
|
+
|8 of clubs |
|
|
72
|
+
|9 of clubs |
|
|
73
|
+
|10 of clubs |
|
|
74
|
+
|J of clubs |
|
|
75
|
+
|K of clubs |
|
|
76
|
+
|Q of clubs |
|
|
77
|
+
|A of hearts |
|
|
78
|
+
|2 of hearts |
|
|
79
|
+
|3 of hearts |
|
|
80
|
+
|4 of hearts |
|
|
81
|
+
|5 of hearts |
|
|
82
|
+
|6 of hearts |
|
|
83
|
+
|7 of hearts |
|
|
84
|
+
|8 of hearts |
|
|
85
|
+
|9 of hearts |
|
|
86
|
+
|10 of hearts |
|
|
87
|
+
|J of hearts |
|
|
88
|
+
|K of hearts |
|
|
89
|
+
|Q of hearts |
|
|
90
|
+
|A of spades |
|
|
91
|
+
|2 of spades |
|
|
92
|
+
|3 of spades |
|
|
93
|
+
|4 of spades |
|
|
94
|
+
|5 of spades |
|
|
95
|
+
|6 of spades |
|
|
96
|
+
|7 of spades |
|
|
97
|
+
|8 of spades |
|
|
98
|
+
|9 of spades |
|
|
99
|
+
|10 of spades |
|
|
100
|
+
|J of spades |
|
|
101
|
+
|K of spades |
|
|
102
|
+
|Q of spades |
|
|
103
|
+
|A of diamonds |
|
|
104
|
+
|2 of diamonds |
|
|
105
|
+
|3 of diamonds |
|
|
106
|
+
|4 of diamonds |
|
|
107
|
+
|5 of diamonds |
|
|
108
|
+
|6 of diamonds |
|
|
109
|
+
|7 of diamonds |
|
|
110
|
+
|8 of diamonds |
|
|
111
|
+
|9 of diamonds |
|
|
112
|
+
|10 of diamonds |
|
|
113
|
+
|J of diamonds |
|
|
114
|
+
|K of diamonds |
|
|
115
|
+
|Q of diamonds |
|
|
116
|
+
|
|
117
|
+
## Contributing
|
|
118
|
+
|
|
119
|
+
1. Fork it ( https://github.com/diegopiccinini/game_shuffle_cards/fork )
|
|
120
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
121
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
122
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
|
123
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED