game_shuffle_cards 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -0,0 +1,196 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
6
|
+
<title>
|
7
|
+
File: README
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.7.6
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '';
|
20
|
+
framesUrl = "frames.html#!file.README.html";
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="_index.html">Index</a> »
|
35
|
+
<span class="title">File: README</span>
|
36
|
+
|
37
|
+
|
38
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<div id="search">
|
42
|
+
|
43
|
+
<a class="full_list_link" id="class_list_link"
|
44
|
+
href="class_list.html">
|
45
|
+
Class List
|
46
|
+
</a>
|
47
|
+
|
48
|
+
<a class="full_list_link" id="method_list_link"
|
49
|
+
href="method_list.html">
|
50
|
+
Method List
|
51
|
+
</a>
|
52
|
+
|
53
|
+
<a class="full_list_link" id="file_list_link"
|
54
|
+
href="file_list.html">
|
55
|
+
File List
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<iframe id="search_frame"></iframe>
|
63
|
+
|
64
|
+
<div id="content"><div id='filecontents'><h1>GameShuffleCards</h1>
|
65
|
+
|
66
|
+
<p>A Game to shuffle a deck of cards and presents the result
|
67
|
+
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.</p>
|
68
|
+
|
69
|
+
<h2>Installation</h2>
|
70
|
+
|
71
|
+
<p>Add this line to your application's Gemfile:</p>
|
72
|
+
|
73
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_gem'>gem</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>game_shuffle_cards</span><span class='tstring_end'>'</span></span>
|
74
|
+
</code></pre>
|
75
|
+
|
76
|
+
<p>And then execute:</p>
|
77
|
+
|
78
|
+
<pre class="code ruby"><code class="ruby">$ bundle
|
79
|
+
</code></pre>
|
80
|
+
|
81
|
+
<p>Or install it yourself as:</p>
|
82
|
+
|
83
|
+
<pre class="code ruby"><code class="ruby">$ gem install game_shuffle_cards
|
84
|
+
</code></pre>
|
85
|
+
|
86
|
+
<h2>Usage</h2>
|
87
|
+
|
88
|
+
<pre class="code ruby"><code class="ruby"><span class='comment'># create a new game with 5 players and 3 cards per player
|
89
|
+
</span><span class='id identifier rubyid_game'>game</span> <span class='op'>=</span> <span class='const'>Game</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='int'>5</span><span class='comma'>,</span><span class='int'>3</span><span class='rparen'>)</span>
|
90
|
+
<span class='comment'># to shuffle a deck of cards , 3 cards per player , to 5 players
|
91
|
+
</span><span class='id identifier rubyid_game'>game</span><span class='period'>.</span><span class='id identifier rubyid_results'>results</span>
|
92
|
+
|
93
|
+
<span class='lbrace'>{</span><span class='int'>0</span><span class='op'>=></span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>8 of spades</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Q of clubs</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>5 of diamonds</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>3 of hearts</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='int'>1</span><span class='op'>=></span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>9 of spades</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>5 of clubs</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>9 of clubs</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>J of clubs</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='rbrace'>}</span>
|
94
|
+
</code></pre>
|
95
|
+
|
96
|
+
<p>If you repeat the <code>game.result</code> the deck will go emptying</p>
|
97
|
+
|
98
|
+
<pre class="code bash"><code class="bash">2.2.0 :003 > g.results
|
99
|
+
=> {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"]}
|
100
|
+
2.2.0 :004 > g.results
|
101
|
+
=> {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"]}
|
102
|
+
2.2.0 :005 > g.results
|
103
|
+
=> {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"]}
|
104
|
+
2.2.0 :006 > g.results
|
105
|
+
=> {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"]}
|
106
|
+
2.2.0 :007 > g.results
|
107
|
+
=> {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"]}
|
108
|
+
2.2.0 :008 > g.results
|
109
|
+
=> {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"]}
|
110
|
+
2.2.0 :009 > g.results
|
111
|
+
=> {0=>["J of diamonds", "7 of hearts", "Q of spades", "6 of hearts"], 1=>[]}
|
112
|
+
2.2.0 :010 > g.results
|
113
|
+
=> {0=>[], 1=>[]}
|
114
|
+
</code></pre>
|
115
|
+
|
116
|
+
<p>If you want to repeat the operation with the same deck, you could instantiate an object again</p>
|
117
|
+
|
118
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_game'>game</span> <span class='op'>=</span> <span class='const'>Game</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
119
|
+
</code></pre>
|
120
|
+
|
121
|
+
<p>And the deck will be full again.</p>
|
122
|
+
|
123
|
+
<p>The deck has defined in class Game the constants you can change it to another type of deck.
|
124
|
+
By default there are 52 cards: 4 suits and 13 values, they are
|
125
|
+
|A of clubs |
|
126
|
+
|2 of clubs |
|
127
|
+
|3 of clubs |
|
128
|
+
|4 of clubs |
|
129
|
+
|5 of clubs |
|
130
|
+
|6 of clubs |
|
131
|
+
|7 of clubs |
|
132
|
+
|8 of clubs |
|
133
|
+
|9 of clubs |
|
134
|
+
|10 of clubs |
|
135
|
+
|J of clubs |
|
136
|
+
|K of clubs |
|
137
|
+
|Q of clubs |
|
138
|
+
|A of hearts |
|
139
|
+
|2 of hearts |
|
140
|
+
|3 of hearts |
|
141
|
+
|4 of hearts |
|
142
|
+
|5 of hearts |
|
143
|
+
|6 of hearts |
|
144
|
+
|7 of hearts |
|
145
|
+
|8 of hearts |
|
146
|
+
|9 of hearts |
|
147
|
+
|10 of hearts |
|
148
|
+
|J of hearts |
|
149
|
+
|K of hearts |
|
150
|
+
|Q of hearts |
|
151
|
+
|A of spades |
|
152
|
+
|2 of spades |
|
153
|
+
|3 of spades |
|
154
|
+
|4 of spades |
|
155
|
+
|5 of spades |
|
156
|
+
|6 of spades |
|
157
|
+
|7 of spades |
|
158
|
+
|8 of spades |
|
159
|
+
|9 of spades |
|
160
|
+
|10 of spades |
|
161
|
+
|J of spades |
|
162
|
+
|K of spades |
|
163
|
+
|Q of spades |
|
164
|
+
|A of diamonds |
|
165
|
+
|2 of diamonds |
|
166
|
+
|3 of diamonds |
|
167
|
+
|4 of diamonds |
|
168
|
+
|5 of diamonds |
|
169
|
+
|6 of diamonds |
|
170
|
+
|7 of diamonds |
|
171
|
+
|8 of diamonds |
|
172
|
+
|9 of diamonds |
|
173
|
+
|10 of diamonds |
|
174
|
+
|J of diamonds |
|
175
|
+
|K of diamonds |
|
176
|
+
|Q of diamonds |</p>
|
177
|
+
|
178
|
+
<h2>Contributing</h2>
|
179
|
+
|
180
|
+
<ol>
|
181
|
+
<li>Fork it ( <a href="https://github.com/diegopiccinini/game_shuffle_cards/fork">https://github.com/diegopiccinini/game_shuffle_cards/fork</a> )</li>
|
182
|
+
<li>Create your feature branch (<code>git checkout -b my-new-feature</code>)</li>
|
183
|
+
<li>Commit your changes (<code>git commit -am 'Add some feature'</code>)</li>
|
184
|
+
<li>Push to the branch (<code>git push origin my-new-feature</code>)</li>
|
185
|
+
<li>Create a new Pull Request</li>
|
186
|
+
</ol>
|
187
|
+
</div></div>
|
188
|
+
|
189
|
+
<div id="footer">
|
190
|
+
Generated on Thu Apr 2 16:38:00 2015 by
|
191
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
192
|
+
0.8.7.6 (ruby-2.2.0).
|
193
|
+
</div>
|
194
|
+
|
195
|
+
</body>
|
196
|
+
</html>
|
data/doc/file_list.html
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
|
7
|
+
<link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" charset="utf-8" />
|
8
|
+
|
9
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
14
|
+
|
15
|
+
<script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
|
16
|
+
|
17
|
+
|
18
|
+
<title>File List</title>
|
19
|
+
<base id="base_target" target="_parent" />
|
20
|
+
</head>
|
21
|
+
<body>
|
22
|
+
<script type="text/javascript" charset="utf-8">
|
23
|
+
var hasFrames = false;
|
24
|
+
try {
|
25
|
+
hasFrames = window.top.frames.main ? true : false;
|
26
|
+
} catch (e) { }
|
27
|
+
if (hasFrames) {
|
28
|
+
document.getElementById('base_target').target = 'main';
|
29
|
+
document.body.className = 'frames';
|
30
|
+
}
|
31
|
+
</script>
|
32
|
+
<div id="content">
|
33
|
+
<h1 id="full_list_header">File List</h1>
|
34
|
+
<div id="nav">
|
35
|
+
|
36
|
+
<span><a target="_self" href="class_list.html">
|
37
|
+
Classes
|
38
|
+
</a></span>
|
39
|
+
|
40
|
+
<span><a target="_self" href="method_list.html">
|
41
|
+
Methods
|
42
|
+
</a></span>
|
43
|
+
|
44
|
+
<span><a target="_self" href="file_list.html">
|
45
|
+
Files
|
46
|
+
</a></span>
|
47
|
+
|
48
|
+
</div>
|
49
|
+
<div id="search">Search: <input type="text" /></div>
|
50
|
+
|
51
|
+
<ul id="full_list" class="file">
|
52
|
+
|
53
|
+
|
54
|
+
<li class="r1"><span class="object_link"><a href="index.html" title="README">README</a></a></li>
|
55
|
+
|
56
|
+
|
57
|
+
</ul>
|
58
|
+
</div>
|
59
|
+
</body>
|
60
|
+
</html>
|
data/doc/frames.html
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
|
3
|
+
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
+
<head>
|
6
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
7
|
+
<title>Documentation by YARD 0.8.7.6</title>
|
8
|
+
</head>
|
9
|
+
<script type="text/javascript" charset="utf-8">
|
10
|
+
window.onload = function() {
|
11
|
+
var match = unescape(window.location.hash).match(/^#!(.+)/);
|
12
|
+
var name = match ? match[1] : 'index.html';
|
13
|
+
name = name.replace(/^(\w+):\/\//, '').replace(/^\/\//, '');
|
14
|
+
document.writeln('<frameset cols="20%,*">' +
|
15
|
+
'<frame name="list" src="class_list.html" />' +
|
16
|
+
'<frame name="main" src="' + escape(name) + '" />' +
|
17
|
+
'</frameset>');
|
18
|
+
}
|
19
|
+
</script>
|
20
|
+
<noscript>
|
21
|
+
<frameset cols="20%,*">
|
22
|
+
<frame name="list" src="class_list.html" />
|
23
|
+
<frame name="main" src="index.html" />
|
24
|
+
</frameset>
|
25
|
+
</noscript>
|
26
|
+
</html>
|
data/doc/index.html
ADDED
@@ -0,0 +1,196 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
6
|
+
<title>
|
7
|
+
File: README
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.7.6
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '';
|
20
|
+
framesUrl = "frames.html#!file.README.html";
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="_index.html">Index</a> »
|
35
|
+
<span class="title">File: README</span>
|
36
|
+
|
37
|
+
|
38
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<div id="search">
|
42
|
+
|
43
|
+
<a class="full_list_link" id="class_list_link"
|
44
|
+
href="class_list.html">
|
45
|
+
Class List
|
46
|
+
</a>
|
47
|
+
|
48
|
+
<a class="full_list_link" id="method_list_link"
|
49
|
+
href="method_list.html">
|
50
|
+
Method List
|
51
|
+
</a>
|
52
|
+
|
53
|
+
<a class="full_list_link" id="file_list_link"
|
54
|
+
href="file_list.html">
|
55
|
+
File List
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<iframe id="search_frame"></iframe>
|
63
|
+
|
64
|
+
<div id="content"><div id='filecontents'><h1>GameShuffleCards</h1>
|
65
|
+
|
66
|
+
<p>A Game to shuffle a deck of cards and presents the result
|
67
|
+
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.</p>
|
68
|
+
|
69
|
+
<h2>Installation</h2>
|
70
|
+
|
71
|
+
<p>Add this line to your application's Gemfile:</p>
|
72
|
+
|
73
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_gem'>gem</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>game_shuffle_cards</span><span class='tstring_end'>'</span></span>
|
74
|
+
</code></pre>
|
75
|
+
|
76
|
+
<p>And then execute:</p>
|
77
|
+
|
78
|
+
<pre class="code ruby"><code class="ruby">$ bundle
|
79
|
+
</code></pre>
|
80
|
+
|
81
|
+
<p>Or install it yourself as:</p>
|
82
|
+
|
83
|
+
<pre class="code ruby"><code class="ruby">$ gem install game_shuffle_cards
|
84
|
+
</code></pre>
|
85
|
+
|
86
|
+
<h2>Usage</h2>
|
87
|
+
|
88
|
+
<pre class="code ruby"><code class="ruby"><span class='comment'># create a new game with 5 players and 3 cards per player
|
89
|
+
</span><span class='id identifier rubyid_game'>game</span> <span class='op'>=</span> <span class='const'>Game</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='int'>5</span><span class='comma'>,</span><span class='int'>3</span><span class='rparen'>)</span>
|
90
|
+
<span class='comment'># to shuffle a deck of cards , 3 cards per player , to 5 players
|
91
|
+
</span><span class='id identifier rubyid_game'>game</span><span class='period'>.</span><span class='id identifier rubyid_results'>results</span>
|
92
|
+
|
93
|
+
<span class='lbrace'>{</span><span class='int'>0</span><span class='op'>=></span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>8 of spades</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Q of clubs</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>5 of diamonds</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>3 of hearts</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='int'>1</span><span class='op'>=></span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>9 of spades</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>5 of clubs</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>9 of clubs</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>J of clubs</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='rbrace'>}</span>
|
94
|
+
</code></pre>
|
95
|
+
|
96
|
+
<p>If you repeat the <code>game.result</code> the deck will go emptying</p>
|
97
|
+
|
98
|
+
<pre class="code bash"><code class="bash">2.2.0 :003 > g.results
|
99
|
+
=> {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"]}
|
100
|
+
2.2.0 :004 > g.results
|
101
|
+
=> {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"]}
|
102
|
+
2.2.0 :005 > g.results
|
103
|
+
=> {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"]}
|
104
|
+
2.2.0 :006 > g.results
|
105
|
+
=> {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"]}
|
106
|
+
2.2.0 :007 > g.results
|
107
|
+
=> {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"]}
|
108
|
+
2.2.0 :008 > g.results
|
109
|
+
=> {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"]}
|
110
|
+
2.2.0 :009 > g.results
|
111
|
+
=> {0=>["J of diamonds", "7 of hearts", "Q of spades", "6 of hearts"], 1=>[]}
|
112
|
+
2.2.0 :010 > g.results
|
113
|
+
=> {0=>[], 1=>[]}
|
114
|
+
</code></pre>
|
115
|
+
|
116
|
+
<p>If you want to repeat the operation with the same deck, you could instantiate an object again</p>
|
117
|
+
|
118
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_game'>game</span> <span class='op'>=</span> <span class='const'>Game</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
119
|
+
</code></pre>
|
120
|
+
|
121
|
+
<p>And the deck will be full again.</p>
|
122
|
+
|
123
|
+
<p>The deck has defined in class Game the constants you can change it to another type of deck.
|
124
|
+
By default there are 52 cards: 4 suits and 13 values, they are
|
125
|
+
|A of clubs |
|
126
|
+
|2 of clubs |
|
127
|
+
|3 of clubs |
|
128
|
+
|4 of clubs |
|
129
|
+
|5 of clubs |
|
130
|
+
|6 of clubs |
|
131
|
+
|7 of clubs |
|
132
|
+
|8 of clubs |
|
133
|
+
|9 of clubs |
|
134
|
+
|10 of clubs |
|
135
|
+
|J of clubs |
|
136
|
+
|K of clubs |
|
137
|
+
|Q of clubs |
|
138
|
+
|A of hearts |
|
139
|
+
|2 of hearts |
|
140
|
+
|3 of hearts |
|
141
|
+
|4 of hearts |
|
142
|
+
|5 of hearts |
|
143
|
+
|6 of hearts |
|
144
|
+
|7 of hearts |
|
145
|
+
|8 of hearts |
|
146
|
+
|9 of hearts |
|
147
|
+
|10 of hearts |
|
148
|
+
|J of hearts |
|
149
|
+
|K of hearts |
|
150
|
+
|Q of hearts |
|
151
|
+
|A of spades |
|
152
|
+
|2 of spades |
|
153
|
+
|3 of spades |
|
154
|
+
|4 of spades |
|
155
|
+
|5 of spades |
|
156
|
+
|6 of spades |
|
157
|
+
|7 of spades |
|
158
|
+
|8 of spades |
|
159
|
+
|9 of spades |
|
160
|
+
|10 of spades |
|
161
|
+
|J of spades |
|
162
|
+
|K of spades |
|
163
|
+
|Q of spades |
|
164
|
+
|A of diamonds |
|
165
|
+
|2 of diamonds |
|
166
|
+
|3 of diamonds |
|
167
|
+
|4 of diamonds |
|
168
|
+
|5 of diamonds |
|
169
|
+
|6 of diamonds |
|
170
|
+
|7 of diamonds |
|
171
|
+
|8 of diamonds |
|
172
|
+
|9 of diamonds |
|
173
|
+
|10 of diamonds |
|
174
|
+
|J of diamonds |
|
175
|
+
|K of diamonds |
|
176
|
+
|Q of diamonds |</p>
|
177
|
+
|
178
|
+
<h2>Contributing</h2>
|
179
|
+
|
180
|
+
<ol>
|
181
|
+
<li>Fork it ( <a href="https://github.com/diegopiccinini/game_shuffle_cards/fork">https://github.com/diegopiccinini/game_shuffle_cards/fork</a> )</li>
|
182
|
+
<li>Create your feature branch (<code>git checkout -b my-new-feature</code>)</li>
|
183
|
+
<li>Commit your changes (<code>git commit -am 'Add some feature'</code>)</li>
|
184
|
+
<li>Push to the branch (<code>git push origin my-new-feature</code>)</li>
|
185
|
+
<li>Create a new Pull Request</li>
|
186
|
+
</ol>
|
187
|
+
</div></div>
|
188
|
+
|
189
|
+
<div id="footer">
|
190
|
+
Generated on Thu Apr 2 16:38:00 2015 by
|
191
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
192
|
+
0.8.7.6 (ruby-2.2.0).
|
193
|
+
</div>
|
194
|
+
|
195
|
+
</body>
|
196
|
+
</html>
|