silicium 0.0.20 → 0.0.21
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/.codeclimate.yml +3 -3
- data/.gitignore +13 -13
- data/.rakeTasks +8 -0
- data/.travis.yml +28 -25
- data/CODE_OF_CONDUCT.md +74 -74
- data/Gemfile +8 -8
- data/LICENSE.txt +21 -21
- data/Makefile +269 -269
- data/README.md +588 -46
- data/Rakefile +16 -16
- data/bin/console +14 -14
- data/bin/setup +8 -8
- data/docs/Object.html +117 -117
- data/docs/README_md.html +142 -142
- data/docs/Silicium/Combinatorics.html +270 -270
- data/docs/Silicium/Dice/Polyhedron.html +315 -315
- data/docs/Silicium/Dice/PolyhedronSet.html +321 -321
- data/docs/Silicium/Dice.html +99 -99
- data/docs/Silicium/Error.html +106 -106
- data/docs/Silicium/Geometry/Line2dCanon.html +243 -243
- data/docs/Silicium/Geometry/VariablesOrderException.html +106 -106
- data/docs/Silicium/Geometry.html +940 -940
- data/docs/Silicium/GraphVisualizer.html +226 -0
- data/docs/Silicium/Graphs/GraphError.html +106 -106
- data/docs/Silicium/Graphs/OrientedGraph.html +901 -775
- data/docs/Silicium/Graphs/UnorientedGraph.html +237 -284
- data/docs/Silicium/Graphs.html +374 -164
- data/docs/Silicium/IntegralDoesntExistError.html +106 -106
- data/docs/Silicium/NumericalIntegration.html +521 -521
- data/docs/Silicium/Optimization.html +629 -639
- data/docs/Silicium/Plotter/Image.html +297 -297
- data/docs/Silicium/Plotter.html +186 -186
- data/docs/Silicium.html +101 -101
- data/docs/created.rid +9 -9
- data/docs/css/fonts.css +167 -167
- data/docs/css/rdoc.css +619 -619
- data/docs/index.html +134 -132
- data/docs/js/darkfish.js +84 -84
- data/docs/js/navigation.js +105 -105
- data/docs/js/search.js +110 -110
- data/docs/js/search_index.js +1 -1
- data/docs/js/search_index.js.gz +0 -0
- data/docs/js/searcher.js +229 -229
- data/docs/table_of_contents.html +697 -608
- data/lib/algebra.rb +452 -0
- data/lib/algebra_diff.rb +258 -0
- data/lib/geometry/figure.rb +62 -0
- data/lib/geometry.rb +290 -236
- data/lib/geometry3d.rb +270 -0
- data/lib/graph/dfs.rb +42 -0
- data/lib/graph/kruskal.rb +36 -0
- data/lib/graph/scc.rb +97 -0
- data/lib/graph.rb +350 -164
- data/lib/graph_visualizer.rb +287 -0
- data/lib/ml_algorithms.rb +181 -0
- data/lib/numerical_integration.rb +184 -147
- data/lib/optimization.rb +209 -144
- data/lib/plotter.rb +256 -96
- data/lib/polynomial_division.rb +132 -0
- data/lib/polynomial_interpolation.rb +94 -0
- data/lib/regression.rb +120 -0
- data/lib/silicium/adding.rb +37 -0
- data/lib/silicium/conversions.rb +23 -0
- data/lib/silicium/multi.rb +82 -0
- data/lib/silicium/sparse.rb +76 -0
- data/lib/silicium/sugar.rb +37 -0
- data/lib/silicium/trans.rb +26 -0
- data/lib/silicium/version.rb +3 -3
- data/lib/silicium.rb +5 -5
- data/lib/theory_of_probability.rb +240 -226
- data/lib/topological_sort.rb +50 -0
- data/oriented_graph.png +0 -0
- data/plot.png +0 -0
- data/silicium.gemspec +38 -39
- metadata +38 -16
@@ -1,315 +1,315 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
|
3
|
-
<html>
|
4
|
-
<head>
|
5
|
-
<meta charset="UTF-8">
|
6
|
-
|
7
|
-
<title>class Silicium::Dice::Polyhedron - RDoc Documentation</title>
|
8
|
-
|
9
|
-
<script type="text/javascript">
|
10
|
-
var rdoc_rel_prefix = "../../";
|
11
|
-
var index_rel_prefix = "../../";
|
12
|
-
</script>
|
13
|
-
|
14
|
-
<script src="../../js/navigation.js" defer></script>
|
15
|
-
<script src="../../js/search.js" defer></script>
|
16
|
-
<script src="../../js/search_index.js" defer></script>
|
17
|
-
<script src="../../js/searcher.js" defer></script>
|
18
|
-
<script src="../../js/darkfish.js" defer></script>
|
19
|
-
|
20
|
-
<link href="../../css/fonts.css" rel="stylesheet">
|
21
|
-
<link href="../../css/rdoc.css" rel="stylesheet">
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
<body id="top" role="document" class="class">
|
27
|
-
<nav role="navigation">
|
28
|
-
<div id="project-navigation">
|
29
|
-
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
30
|
-
<h2>
|
31
|
-
<a href="../../index.html" rel="home">Home</a>
|
32
|
-
</h2>
|
33
|
-
|
34
|
-
<div id="table-of-contents-navigation">
|
35
|
-
<a href="../../table_of_contents.html#pages">Pages</a>
|
36
|
-
<a href="../../table_of_contents.html#classes">Classes</a>
|
37
|
-
<a href="../../table_of_contents.html#methods">Methods</a>
|
38
|
-
</div>
|
39
|
-
</div>
|
40
|
-
|
41
|
-
<div id="search-section" role="search" class="project-section initially-hidden">
|
42
|
-
<form action="#" method="get" accept-charset="utf-8">
|
43
|
-
<div id="search-field-wrapper">
|
44
|
-
<input id="search-field" role="combobox" aria-label="Search"
|
45
|
-
aria-autocomplete="list" aria-controls="search-results"
|
46
|
-
type="text" name="search" placeholder="Search" spellcheck="false"
|
47
|
-
title="Type to search, Up and Down to navigate, Enter to load">
|
48
|
-
</div>
|
49
|
-
|
50
|
-
<ul id="search-results" aria-label="Search Results"
|
51
|
-
aria-busy="false" aria-expanded="false"
|
52
|
-
aria-atomic="false" class="initially-hidden"></ul>
|
53
|
-
</form>
|
54
|
-
</div>
|
55
|
-
|
56
|
-
</div>
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
<div id="class-metadata">
|
61
|
-
|
62
|
-
<div id="parent-class-section" class="nav-section">
|
63
|
-
<h3>Parent</h3>
|
64
|
-
|
65
|
-
|
66
|
-
<p class="link"><a href="../../Object.html">Object</a>
|
67
|
-
|
68
|
-
</div>
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
<!-- Method Quickref -->
|
73
|
-
<div id="method-list-section" class="nav-section">
|
74
|
-
<h3>Methods</h3>
|
75
|
-
|
76
|
-
<ul class="link-list" role="directory">
|
77
|
-
|
78
|
-
<li ><a href="#method-c-new">::new</a>
|
79
|
-
|
80
|
-
<li ><a href="#method-i-csides">#csides</a>
|
81
|
-
|
82
|
-
<li ><a href="#method-i-sides">#sides</a>
|
83
|
-
|
84
|
-
<li ><a href="#method-i-throw">#throw</a>
|
85
|
-
|
86
|
-
<li ><a href="#method-i-to_s">#to_s</a>
|
87
|
-
|
88
|
-
</ul>
|
89
|
-
</div>
|
90
|
-
|
91
|
-
</div>
|
92
|
-
</nav>
|
93
|
-
|
94
|
-
<main role="main" aria-labelledby="class-Silicium::Dice::Polyhedron">
|
95
|
-
<h1 id="class-Silicium::Dice::Polyhedron" class="class">
|
96
|
-
class Silicium::Dice::Polyhedron
|
97
|
-
</h1>
|
98
|
-
|
99
|
-
<section class="description">
|
100
|
-
|
101
|
-
<p>Class represents a polyhedron csides - number or sides sides - array of sides(unusual for custom polyhedrons)</p>
|
102
|
-
|
103
|
-
</section>
|
104
|
-
|
105
|
-
|
106
|
-
<section id="5Buntitled-5D" class="documentation-section">
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
117
|
-
<header>
|
118
|
-
<h3>Public Class Methods</h3>
|
119
|
-
</header>
|
120
|
-
|
121
|
-
|
122
|
-
<div id="method-c-new" class="method-detail ">
|
123
|
-
|
124
|
-
<div class="method-heading">
|
125
|
-
<span class="method-name">new</span><span
|
126
|
-
class="method-args">(sides)</span>
|
127
|
-
|
128
|
-
<span class="method-click-advice">click to toggle source</span>
|
129
|
-
|
130
|
-
</div>
|
131
|
-
|
132
|
-
|
133
|
-
<div class="method-description">
|
134
|
-
|
135
|
-
<p>initializing polyhedron's variables there are two ways how to create it 1: by number (6) - creates polyhedron with 6 sides [1,2,3,4,5,6] 2: by array ([1,3,5]) - creates polyhedron with 3 sides [1,3,5]</p>
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
<div class="method-source-code" id="new-source">
|
141
|
-
<pre><span class="ruby-comment"># File lib/theory_of_probability.rb, line 94</span>
|
142
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">sides</span>)
|
143
|
-
<span class="ruby-ivar">@csides</span> = <span class="ruby-value">1</span>
|
144
|
-
<span class="ruby-ivar">@sides</span> = [<span class="ruby-value">1</span>]
|
145
|
-
<span class="ruby-keyword">if</span> <span class="ruby-identifier">sides</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Integer</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">sides</span> <span class="ruby-operator">></span> <span class="ruby-value">1</span>
|
146
|
-
<span class="ruby-ivar">@csides</span> = <span class="ruby-identifier">sides</span>
|
147
|
-
(<span class="ruby-value">2</span><span class="ruby-operator">..</span><span class="ruby-identifier">sides</span>).<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@sides</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">i</span>}
|
148
|
-
<span class="ruby-keyword">elsif</span> <span class="ruby-identifier">sides</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Array</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">sides</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
149
|
-
<span class="ruby-ivar">@csides</span> = <span class="ruby-identifier">sides</span>.<span class="ruby-identifier">size</span>
|
150
|
-
<span class="ruby-ivar">@sides</span> = <span class="ruby-identifier">sides</span>.<span class="ruby-identifier">sort</span>
|
151
|
-
<span class="ruby-keyword">end</span>
|
152
|
-
<span class="ruby-keyword">end</span></pre>
|
153
|
-
</div>
|
154
|
-
|
155
|
-
</div>
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
</div>
|
161
|
-
|
162
|
-
|
163
|
-
</section>
|
164
|
-
|
165
|
-
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
166
|
-
<header>
|
167
|
-
<h3>Public Instance Methods</h3>
|
168
|
-
</header>
|
169
|
-
|
170
|
-
|
171
|
-
<div id="method-i-csides" class="method-detail ">
|
172
|
-
|
173
|
-
<div class="method-heading">
|
174
|
-
<span class="method-name">csides</span><span
|
175
|
-
class="method-args">()</span>
|
176
|
-
|
177
|
-
<span class="method-click-advice">click to toggle source</span>
|
178
|
-
|
179
|
-
</div>
|
180
|
-
|
181
|
-
|
182
|
-
<div class="method-description">
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
<div class="method-source-code" id="csides-source">
|
190
|
-
<pre><span class="ruby-comment"># File lib/theory_of_probability.rb, line 77</span>
|
191
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">csides</span>
|
192
|
-
<span class="ruby-ivar">@csides</span>
|
193
|
-
<span class="ruby-keyword">end</span></pre>
|
194
|
-
</div>
|
195
|
-
|
196
|
-
</div>
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
</div>
|
202
|
-
|
203
|
-
|
204
|
-
<div id="method-i-sides" class="method-detail ">
|
205
|
-
|
206
|
-
<div class="method-heading">
|
207
|
-
<span class="method-name">sides</span><span
|
208
|
-
class="method-args">()</span>
|
209
|
-
|
210
|
-
<span class="method-click-advice">click to toggle source</span>
|
211
|
-
|
212
|
-
</div>
|
213
|
-
|
214
|
-
|
215
|
-
<div class="method-description">
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
<div class="method-source-code" id="sides-source">
|
223
|
-
<pre><span class="ruby-comment"># File lib/theory_of_probability.rb, line 81</span>
|
224
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">sides</span>
|
225
|
-
<span class="ruby-ivar">@sides</span>
|
226
|
-
<span class="ruby-keyword">end</span></pre>
|
227
|
-
</div>
|
228
|
-
|
229
|
-
</div>
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
</div>
|
235
|
-
|
236
|
-
|
237
|
-
<div id="method-i-throw" class="method-detail ">
|
238
|
-
|
239
|
-
<div class="method-heading">
|
240
|
-
<span class="method-name">throw</span><span
|
241
|
-
class="method-args">()</span>
|
242
|
-
|
243
|
-
<span class="method-click-advice">click to toggle source</span>
|
244
|
-
|
245
|
-
</div>
|
246
|
-
|
247
|
-
|
248
|
-
<div class="method-description">
|
249
|
-
|
250
|
-
<p>ability to throw a polyhedron</p>
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
<div class="method-source-code" id="throw-source">
|
256
|
-
<pre><span class="ruby-comment"># File lib/theory_of_probability.rb, line 108</span>
|
257
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">throw</span>
|
258
|
-
<span class="ruby-ivar">@sides</span>[<span class="ruby-identifier">rand</span>(<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-ivar">@csides</span><span class="ruby-value">-1</span>)]
|
259
|
-
<span class="ruby-keyword">end</span></pre>
|
260
|
-
</div>
|
261
|
-
|
262
|
-
</div>
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
</div>
|
268
|
-
|
269
|
-
|
270
|
-
<div id="method-i-to_s" class="method-detail ">
|
271
|
-
|
272
|
-
<div class="method-heading">
|
273
|
-
<span class="method-name">to_s</span><span
|
274
|
-
class="method-args">()</span>
|
275
|
-
|
276
|
-
<span class="method-click-advice">click to toggle source</span>
|
277
|
-
|
278
|
-
</div>
|
279
|
-
|
280
|
-
|
281
|
-
<div class="method-description">
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
<div class="method-source-code" id="to_s-source">
|
289
|
-
<pre><span class="ruby-comment"># File lib/theory_of_probability.rb, line 85</span>
|
290
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_s</span>
|
291
|
-
<span class="ruby-identifier">sides</span>
|
292
|
-
<span class="ruby-keyword">end</span></pre>
|
293
|
-
</div>
|
294
|
-
|
295
|
-
</div>
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
</div>
|
301
|
-
|
302
|
-
|
303
|
-
</section>
|
304
|
-
|
305
|
-
</section>
|
306
|
-
|
307
|
-
</main>
|
308
|
-
|
309
|
-
|
310
|
-
<footer id="validator-badges" role="contentinfo">
|
311
|
-
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
312
|
-
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.2.0.
|
313
|
-
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
314
|
-
</footer>
|
315
|
-
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>class Silicium::Dice::Polyhedron - RDoc Documentation</title>
|
8
|
+
|
9
|
+
<script type="text/javascript">
|
10
|
+
var rdoc_rel_prefix = "../../";
|
11
|
+
var index_rel_prefix = "../../";
|
12
|
+
</script>
|
13
|
+
|
14
|
+
<script src="../../js/navigation.js" defer></script>
|
15
|
+
<script src="../../js/search.js" defer></script>
|
16
|
+
<script src="../../js/search_index.js" defer></script>
|
17
|
+
<script src="../../js/searcher.js" defer></script>
|
18
|
+
<script src="../../js/darkfish.js" defer></script>
|
19
|
+
|
20
|
+
<link href="../../css/fonts.css" rel="stylesheet">
|
21
|
+
<link href="../../css/rdoc.css" rel="stylesheet">
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
<body id="top" role="document" class="class">
|
27
|
+
<nav role="navigation">
|
28
|
+
<div id="project-navigation">
|
29
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
30
|
+
<h2>
|
31
|
+
<a href="../../index.html" rel="home">Home</a>
|
32
|
+
</h2>
|
33
|
+
|
34
|
+
<div id="table-of-contents-navigation">
|
35
|
+
<a href="../../table_of_contents.html#pages">Pages</a>
|
36
|
+
<a href="../../table_of_contents.html#classes">Classes</a>
|
37
|
+
<a href="../../table_of_contents.html#methods">Methods</a>
|
38
|
+
</div>
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
42
|
+
<form action="#" method="get" accept-charset="utf-8">
|
43
|
+
<div id="search-field-wrapper">
|
44
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
45
|
+
aria-autocomplete="list" aria-controls="search-results"
|
46
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
47
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
48
|
+
</div>
|
49
|
+
|
50
|
+
<ul id="search-results" aria-label="Search Results"
|
51
|
+
aria-busy="false" aria-expanded="false"
|
52
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
53
|
+
</form>
|
54
|
+
</div>
|
55
|
+
|
56
|
+
</div>
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
<div id="class-metadata">
|
61
|
+
|
62
|
+
<div id="parent-class-section" class="nav-section">
|
63
|
+
<h3>Parent</h3>
|
64
|
+
|
65
|
+
|
66
|
+
<p class="link"><a href="../../Object.html">Object</a>
|
67
|
+
|
68
|
+
</div>
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
<!-- Method Quickref -->
|
73
|
+
<div id="method-list-section" class="nav-section">
|
74
|
+
<h3>Methods</h3>
|
75
|
+
|
76
|
+
<ul class="link-list" role="directory">
|
77
|
+
|
78
|
+
<li ><a href="#method-c-new">::new</a>
|
79
|
+
|
80
|
+
<li ><a href="#method-i-csides">#csides</a>
|
81
|
+
|
82
|
+
<li ><a href="#method-i-sides">#sides</a>
|
83
|
+
|
84
|
+
<li ><a href="#method-i-throw">#throw</a>
|
85
|
+
|
86
|
+
<li ><a href="#method-i-to_s">#to_s</a>
|
87
|
+
|
88
|
+
</ul>
|
89
|
+
</div>
|
90
|
+
|
91
|
+
</div>
|
92
|
+
</nav>
|
93
|
+
|
94
|
+
<main role="main" aria-labelledby="class-Silicium::Dice::Polyhedron">
|
95
|
+
<h1 id="class-Silicium::Dice::Polyhedron" class="class">
|
96
|
+
class Silicium::Dice::Polyhedron
|
97
|
+
</h1>
|
98
|
+
|
99
|
+
<section class="description">
|
100
|
+
|
101
|
+
<p>Class represents a polyhedron csides - number or sides sides - array of sides(unusual for custom polyhedrons)</p>
|
102
|
+
|
103
|
+
</section>
|
104
|
+
|
105
|
+
|
106
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
117
|
+
<header>
|
118
|
+
<h3>Public Class Methods</h3>
|
119
|
+
</header>
|
120
|
+
|
121
|
+
|
122
|
+
<div id="method-c-new" class="method-detail ">
|
123
|
+
|
124
|
+
<div class="method-heading">
|
125
|
+
<span class="method-name">new</span><span
|
126
|
+
class="method-args">(sides)</span>
|
127
|
+
|
128
|
+
<span class="method-click-advice">click to toggle source</span>
|
129
|
+
|
130
|
+
</div>
|
131
|
+
|
132
|
+
|
133
|
+
<div class="method-description">
|
134
|
+
|
135
|
+
<p>initializing polyhedron's variables there are two ways how to create it 1: by number (6) - creates polyhedron with 6 sides [1,2,3,4,5,6] 2: by array ([1,3,5]) - creates polyhedron with 3 sides [1,3,5]</p>
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
<div class="method-source-code" id="new-source">
|
141
|
+
<pre><span class="ruby-comment"># File lib/theory_of_probability.rb, line 94</span>
|
142
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">sides</span>)
|
143
|
+
<span class="ruby-ivar">@csides</span> = <span class="ruby-value">1</span>
|
144
|
+
<span class="ruby-ivar">@sides</span> = [<span class="ruby-value">1</span>]
|
145
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">sides</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Integer</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">sides</span> <span class="ruby-operator">></span> <span class="ruby-value">1</span>
|
146
|
+
<span class="ruby-ivar">@csides</span> = <span class="ruby-identifier">sides</span>
|
147
|
+
(<span class="ruby-value">2</span><span class="ruby-operator">..</span><span class="ruby-identifier">sides</span>).<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@sides</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">i</span>}
|
148
|
+
<span class="ruby-keyword">elsif</span> <span class="ruby-identifier">sides</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Array</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">sides</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
149
|
+
<span class="ruby-ivar">@csides</span> = <span class="ruby-identifier">sides</span>.<span class="ruby-identifier">size</span>
|
150
|
+
<span class="ruby-ivar">@sides</span> = <span class="ruby-identifier">sides</span>.<span class="ruby-identifier">sort</span>
|
151
|
+
<span class="ruby-keyword">end</span>
|
152
|
+
<span class="ruby-keyword">end</span></pre>
|
153
|
+
</div>
|
154
|
+
|
155
|
+
</div>
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
</div>
|
161
|
+
|
162
|
+
|
163
|
+
</section>
|
164
|
+
|
165
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
166
|
+
<header>
|
167
|
+
<h3>Public Instance Methods</h3>
|
168
|
+
</header>
|
169
|
+
|
170
|
+
|
171
|
+
<div id="method-i-csides" class="method-detail ">
|
172
|
+
|
173
|
+
<div class="method-heading">
|
174
|
+
<span class="method-name">csides</span><span
|
175
|
+
class="method-args">()</span>
|
176
|
+
|
177
|
+
<span class="method-click-advice">click to toggle source</span>
|
178
|
+
|
179
|
+
</div>
|
180
|
+
|
181
|
+
|
182
|
+
<div class="method-description">
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
<div class="method-source-code" id="csides-source">
|
190
|
+
<pre><span class="ruby-comment"># File lib/theory_of_probability.rb, line 77</span>
|
191
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">csides</span>
|
192
|
+
<span class="ruby-ivar">@csides</span>
|
193
|
+
<span class="ruby-keyword">end</span></pre>
|
194
|
+
</div>
|
195
|
+
|
196
|
+
</div>
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
</div>
|
202
|
+
|
203
|
+
|
204
|
+
<div id="method-i-sides" class="method-detail ">
|
205
|
+
|
206
|
+
<div class="method-heading">
|
207
|
+
<span class="method-name">sides</span><span
|
208
|
+
class="method-args">()</span>
|
209
|
+
|
210
|
+
<span class="method-click-advice">click to toggle source</span>
|
211
|
+
|
212
|
+
</div>
|
213
|
+
|
214
|
+
|
215
|
+
<div class="method-description">
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
<div class="method-source-code" id="sides-source">
|
223
|
+
<pre><span class="ruby-comment"># File lib/theory_of_probability.rb, line 81</span>
|
224
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">sides</span>
|
225
|
+
<span class="ruby-ivar">@sides</span>
|
226
|
+
<span class="ruby-keyword">end</span></pre>
|
227
|
+
</div>
|
228
|
+
|
229
|
+
</div>
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
</div>
|
235
|
+
|
236
|
+
|
237
|
+
<div id="method-i-throw" class="method-detail ">
|
238
|
+
|
239
|
+
<div class="method-heading">
|
240
|
+
<span class="method-name">throw</span><span
|
241
|
+
class="method-args">()</span>
|
242
|
+
|
243
|
+
<span class="method-click-advice">click to toggle source</span>
|
244
|
+
|
245
|
+
</div>
|
246
|
+
|
247
|
+
|
248
|
+
<div class="method-description">
|
249
|
+
|
250
|
+
<p>ability to throw a polyhedron</p>
|
251
|
+
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
<div class="method-source-code" id="throw-source">
|
256
|
+
<pre><span class="ruby-comment"># File lib/theory_of_probability.rb, line 108</span>
|
257
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">throw</span>
|
258
|
+
<span class="ruby-ivar">@sides</span>[<span class="ruby-identifier">rand</span>(<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-ivar">@csides</span><span class="ruby-value">-1</span>)]
|
259
|
+
<span class="ruby-keyword">end</span></pre>
|
260
|
+
</div>
|
261
|
+
|
262
|
+
</div>
|
263
|
+
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
</div>
|
268
|
+
|
269
|
+
|
270
|
+
<div id="method-i-to_s" class="method-detail ">
|
271
|
+
|
272
|
+
<div class="method-heading">
|
273
|
+
<span class="method-name">to_s</span><span
|
274
|
+
class="method-args">()</span>
|
275
|
+
|
276
|
+
<span class="method-click-advice">click to toggle source</span>
|
277
|
+
|
278
|
+
</div>
|
279
|
+
|
280
|
+
|
281
|
+
<div class="method-description">
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
<div class="method-source-code" id="to_s-source">
|
289
|
+
<pre><span class="ruby-comment"># File lib/theory_of_probability.rb, line 85</span>
|
290
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_s</span>
|
291
|
+
<span class="ruby-identifier">sides</span>
|
292
|
+
<span class="ruby-keyword">end</span></pre>
|
293
|
+
</div>
|
294
|
+
|
295
|
+
</div>
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
|
300
|
+
</div>
|
301
|
+
|
302
|
+
|
303
|
+
</section>
|
304
|
+
|
305
|
+
</section>
|
306
|
+
|
307
|
+
</main>
|
308
|
+
|
309
|
+
|
310
|
+
<footer id="validator-badges" role="contentinfo">
|
311
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
312
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.2.0.
|
313
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
314
|
+
</footer>
|
315
|
+
|