Dogeku 1.0.1
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/LICENSE +21 -0
- data/README.md +39 -0
- data/app/Historique/Action.rb +29 -0
- data/app/Historique/ChangerCase.rb +44 -0
- data/app/Historique/HistoriqueAction.rb +114 -0
- data/app/components/CaseDessin.rb +325 -0
- data/app/components/GrilleDessin.rb +235 -0
- data/app/components/Header.rb +194 -0
- data/app/config/app.yml +0 -0
- data/app/config/database.yml +2 -0
- data/app/controller/ApprentissageControleur.rb +75 -0
- data/app/controller/ChargerControleur.rb +41 -0
- data/app/controller/JeuLibreControleur.rb +244 -0
- data/app/controller/MenuControleur.rb +57 -0
- data/app/controller/NiveauControleur.rb +54 -0
- data/app/controller/NouvellePartieControleur.rb +34 -0
- data/app/controller/PrincipaleControleur.rb +30 -0
- data/app/controller/PseudoControleur.rb +95 -0
- data/app/controller/ReglagesControleur.rb +86 -0
- data/app/controller/ReglesControleur.rb +34 -0
- data/app/controller/ScoresControleur.rb +42 -0
- data/app/controller/StatistiquesControleur.rb +64 -0
- data/app/core/Conf.rb +26 -0
- data/app/core/Controller.rb +180 -0
- data/app/core/Core.rb +186 -0
- data/app/core/Model.rb +159 -0
- data/app/core/View.rb +56 -0
- data/app/db/main.sqlite3 +0 -0
- data/app/model/Configuration.rb +180 -0
- data/app/model/Grille.rb +180 -0
- data/app/model/Jeu.rb +74 -0
- data/app/model/Score.rb +100 -0
- data/app/model/Utilisateur.rb +113 -0
- data/app/utils/DSubset.rb +98 -0
- data/app/utils/Generateur.rb +171 -0
- data/app/utils/HPTriple.rb +75 -0
- data/app/utils/Peche.rb +46 -0
- data/app/utils/SCandidate.rb +86 -0
- data/app/utils/SCell.rb +73 -0
- data/app/utils/Technique.rb +202 -0
- data/app/utils/TechniqueUsine.rb +25 -0
- data/app/utils/XWing.rb +203 -0
- data/app/view/Fenetre.rb +424 -0
- data/app/view/FenetreApprentissage.rb +272 -0
- data/app/view/FenetreCharger.rb +31 -0
- data/app/view/FenetreJeuLibre.rb +468 -0
- data/app/view/FenetreMenu.rb +198 -0
- data/app/view/FenetreNiveau.rb +105 -0
- data/app/view/FenetreNouvellePartie.rb +92 -0
- data/app/view/FenetrePrincipale.rb +45 -0
- data/app/view/FenetrePseudo.rb +115 -0
- data/app/view/FenetreReglages.rb +209 -0
- data/app/view/FenetreRegles.rb +111 -0
- data/app/view/FenetreScores.rb +120 -0
- data/app/view/FenetreStatistiques.rb +134 -0
- data/assets/css/style.css +69 -0
- data/assets/img/eraser.png +0 -0
- data/assets/img/fond.jpg +0 -0
- data/assets/img/iconApp.png +0 -0
- data/assets/img/logoS.jpeg +0 -0
- data/assets/img/sudokuIntro.jpg +0 -0
- data/assets/img/user.png +0 -0
- data/bin/dogeku +19 -0
- data/doc/Action.html +309 -0
- data/doc/ApprentissageControleur.html +568 -0
- data/doc/CaseDessin.html +2405 -0
- data/doc/ChangerCase.html +405 -0
- data/doc/ChargerControleur.html +342 -0
- data/doc/Conf.html +378 -0
- data/doc/Configuration.html +1115 -0
- data/doc/Controller.html +1008 -0
- data/doc/Core.html +1191 -0
- data/doc/DSubset.html +647 -0
- data/doc/Fenetre.html +2631 -0
- data/doc/FenetreApprentissage.html +1175 -0
- data/doc/FenetreCharger.html +343 -0
- data/doc/FenetreJeuLibre.html +1859 -0
- data/doc/FenetreMenu.html +900 -0
- data/doc/FenetreNiveau.html +626 -0
- data/doc/FenetreNouvellePartie.html +602 -0
- data/doc/FenetrePrincipale.html +371 -0
- data/doc/FenetrePseudo.html +695 -0
- data/doc/FenetreReglages.html +946 -0
- data/doc/FenetreRegles.html +636 -0
- data/doc/FenetreScores.html +650 -0
- data/doc/FenetreStatistiques.html +672 -0
- data/doc/Generateur.html +1015 -0
- data/doc/Grille.html +1348 -0
- data/doc/GrilleDessin.html +1281 -0
- data/doc/HPTriple.html +593 -0
- data/doc/Header.html +1253 -0
- data/doc/HistoriqueAction.html +792 -0
- data/doc/Jeu.html +923 -0
- data/doc/JeuLibreControleur.html +1445 -0
- data/doc/MenuControleur.html +522 -0
- data/doc/Model.html +996 -0
- data/doc/NiveauControleur.html +451 -0
- data/doc/NouvellePartieControleur.html +330 -0
- data/doc/Peche.html +396 -0
- data/doc/PrincipaleControleur.html +320 -0
- data/doc/PseudoControleur.html +695 -0
- data/doc/ReglagesControleur.html +747 -0
- data/doc/ReglesControleur.html +330 -0
- data/doc/SCandidate.html +617 -0
- data/doc/SCell.html +587 -0
- data/doc/Score.html +926 -0
- data/doc/ScoresControleur.html +346 -0
- data/doc/StatistiquesControleur.html +390 -0
- data/doc/Technique.html +543 -0
- data/doc/TechniqueUsine.html +252 -0
- data/doc/Utilisateur.html +806 -0
- data/doc/View.html +844 -0
- data/doc/XWing.html +1031 -0
- data/doc/_index.html +478 -0
- data/doc/class_list.html +51 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +58 -0
- data/doc/css/style.css +492 -0
- data/doc/file.README.html +141 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +17 -0
- data/doc/index.html +141 -0
- data/doc/js/app.js +243 -0
- data/doc/js/full_list.js +216 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +2523 -0
- data/doc/top-level-namespace.html +112 -0
- data/test/Generateur/grilleCorrecte.rb +198 -0
- data/test/Model/scoreCorrecte.rb +55 -0
- data/test/Model/utilisateurCorrecte.rb +68 -0
- data/test/test_helper.rb +2 -0
- data/test/unitTest.rb +72 -0
- metadata +187 -0
data/doc/Score.html
ADDED
|
@@ -0,0 +1,926 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>
|
|
7
|
+
Class: Score
|
|
8
|
+
|
|
9
|
+
— Documentation by YARD 0.9.8
|
|
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
|
+
pathId = "Score";
|
|
19
|
+
relpath = '';
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
|
24
|
+
|
|
25
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
</head>
|
|
29
|
+
<body>
|
|
30
|
+
<div class="nav_wrap">
|
|
31
|
+
<iframe id="nav" src="class_list.html?1"></iframe>
|
|
32
|
+
<div id="resizer"></div>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
<div id="main" tabindex="-1">
|
|
36
|
+
<div id="header">
|
|
37
|
+
<div id="menu">
|
|
38
|
+
|
|
39
|
+
<a href="_index.html">Index (S)</a> »
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
<span class="title">Score</span>
|
|
43
|
+
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<div id="search">
|
|
47
|
+
|
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
|
49
|
+
href="class_list.html">
|
|
50
|
+
|
|
51
|
+
<svg width="24" height="24">
|
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
|
55
|
+
</svg>
|
|
56
|
+
</a>
|
|
57
|
+
|
|
58
|
+
</div>
|
|
59
|
+
<div class="clear"></div>
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
<div id="content"><h1>Class: Score
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
</h1>
|
|
67
|
+
<div class="box_info">
|
|
68
|
+
|
|
69
|
+
<dl>
|
|
70
|
+
<dt>Inherits:</dt>
|
|
71
|
+
<dd>
|
|
72
|
+
<span class="inheritName"><span class='object_link'><a href="Model.html" title="Model (class)">Model</a></span></span>
|
|
73
|
+
|
|
74
|
+
<ul class="fullTree">
|
|
75
|
+
<li>Object</li>
|
|
76
|
+
|
|
77
|
+
<li class="next"><span class='object_link'><a href="Model.html" title="Model (class)">Model</a></span></li>
|
|
78
|
+
|
|
79
|
+
<li class="next">Score</li>
|
|
80
|
+
|
|
81
|
+
</ul>
|
|
82
|
+
<a href="#" class="inheritanceTree">show all</a>
|
|
83
|
+
|
|
84
|
+
</dd>
|
|
85
|
+
</dl>
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
<dl>
|
|
98
|
+
<dt>Defined in:</dt>
|
|
99
|
+
<dd>app/model/Score.rb</dd>
|
|
100
|
+
</dl>
|
|
101
|
+
|
|
102
|
+
</div>
|
|
103
|
+
|
|
104
|
+
<h2>Overview</h2><div class="docstring">
|
|
105
|
+
<div class="discussion">
|
|
106
|
+
|
|
107
|
+
<p>Modèle pour le score</p>
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
<div class="tags">
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
</div>
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
<h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
|
|
120
|
+
<ul class="summary">
|
|
121
|
+
|
|
122
|
+
<li class="public ">
|
|
123
|
+
<span class="summary_signature">
|
|
124
|
+
|
|
125
|
+
<a href="#difficulte-instance_method" title="#difficulte (instance method)">#<strong>difficulte</strong> ⇒ Object </a>
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
</span>
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
<span class="summary_desc"><div class='inline'>
|
|
143
|
+
<p>Returns the value of attribute difficulte.</p>
|
|
144
|
+
</div></span>
|
|
145
|
+
|
|
146
|
+
</li>
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
</ul>
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
<h3 class="inherited">Attributes inherited from <span class='object_link'><a href="Model.html" title="Model (class)">Model</a></span></h3>
|
|
156
|
+
<p class="inherited"><span class='object_link'><a href="Model.html#db-instance_method" title="Model#db (method)">#db</a></span></p>
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
<h2>
|
|
161
|
+
Instance Method Summary
|
|
162
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
|
163
|
+
</h2>
|
|
164
|
+
|
|
165
|
+
<ul class="summary">
|
|
166
|
+
|
|
167
|
+
<li class="public ">
|
|
168
|
+
<span class="summary_signature">
|
|
169
|
+
|
|
170
|
+
<a href="#calcul-instance_method" title="#calcul (instance method)">#<strong>calcul</strong>(penalite, tempsChrono) ⇒ Object </a>
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
</span>
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
<span class="summary_desc"><div class='inline'>
|
|
185
|
+
<p>Calcule le score du joueur.</p>
|
|
186
|
+
</div></span>
|
|
187
|
+
|
|
188
|
+
</li>
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
<li class="public ">
|
|
192
|
+
<span class="summary_signature">
|
|
193
|
+
|
|
194
|
+
<a href="#creer-instance_method" title="#creer (instance method)">#<strong>creer</strong>(pseudo, niveau, score) ⇒ Object </a>
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
</span>
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
<span class="summary_desc"><div class='inline'>
|
|
209
|
+
<p>Crée un score dans la table score pour l'utilisateur.</p>
|
|
210
|
+
</div></span>
|
|
211
|
+
|
|
212
|
+
</li>
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
<li class="public ">
|
|
216
|
+
<span class="summary_signature">
|
|
217
|
+
|
|
218
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong> ⇒ Score </a>
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
</span>
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
<span class="note title constructor">constructor</span>
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
<span class="summary_desc"><div class='inline'>
|
|
235
|
+
<p>Initialisation.</p>
|
|
236
|
+
</div></span>
|
|
237
|
+
|
|
238
|
+
</li>
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
<li class="public ">
|
|
242
|
+
<span class="summary_signature">
|
|
243
|
+
|
|
244
|
+
<a href="#meilleursScores-instance_method" title="#meilleursScores (instance method)">#<strong>meilleursScores</strong>(n) ⇒ Object </a>
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
</span>
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
<span class="summary_desc"><div class='inline'>
|
|
259
|
+
<p>Récupère les n meilleures scores.</p>
|
|
260
|
+
</div></span>
|
|
261
|
+
|
|
262
|
+
</li>
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
<li class="public ">
|
|
266
|
+
<span class="summary_signature">
|
|
267
|
+
|
|
268
|
+
<a href="#mettreAJour-instance_method" title="#mettreAJour (instance method)">#<strong>mettreAJour</strong>(score_id, score) ⇒ Object </a>
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
</span>
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
<span class="summary_desc"><div class='inline'>
|
|
283
|
+
<p>Met à jour le score d'un utilisateur.</p>
|
|
284
|
+
</div></span>
|
|
285
|
+
|
|
286
|
+
</li>
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
<li class="public ">
|
|
290
|
+
<span class="summary_signature">
|
|
291
|
+
|
|
292
|
+
<a href="#scoreUtilisateur-instance_method" title="#scoreUtilisateur (instance method)">#<strong>scoreUtilisateur</strong>(pseudo) ⇒ Object </a>
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
</span>
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
<span class="summary_desc"><div class='inline'>
|
|
307
|
+
<p>Récupère les scores de l'utilisateur.</p>
|
|
308
|
+
</div></span>
|
|
309
|
+
|
|
310
|
+
</li>
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
</ul>
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="Model.html" title="Model (class)">Model</a></span></h3>
|
|
326
|
+
<p class="inherited"><span class='object_link'><a href="Model.html#connection-instance_method" title="Model#connection (method)">#connection</a></span>, <span class='object_link'><a href="Model.html#inherited-class_method" title="Model.inherited (method)">inherited</a></span>, <span class='object_link'><a href="Model.html#insert-instance_method" title="Model#insert (method)">#insert</a></span>, <span class='object_link'><a href="Model.html#mkDatabaseDir-instance_method" title="Model#mkDatabaseDir (method)">#mkDatabaseDir</a></span>, <span class='object_link'><a href="Model.html#to_h-instance_method" title="Model#to_h (method)">#to_h</a></span></p>
|
|
327
|
+
|
|
328
|
+
<div id="constructor_details" class="method_details_list">
|
|
329
|
+
<h2>Constructor Details</h2>
|
|
330
|
+
|
|
331
|
+
<div class="method_details first">
|
|
332
|
+
<h3 class="signature first" id="initialize-instance_method">
|
|
333
|
+
|
|
334
|
+
#<strong>initialize</strong> ⇒ <tt><span class='object_link'><a href="" title="Score (class)">Score</a></span></tt>
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
</h3><div class="docstring">
|
|
341
|
+
<div class="discussion">
|
|
342
|
+
|
|
343
|
+
<p>Initialisation</p>
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
</div>
|
|
347
|
+
</div>
|
|
348
|
+
<div class="tags">
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
</div><table class="source_code">
|
|
352
|
+
<tr>
|
|
353
|
+
<td>
|
|
354
|
+
<pre class="lines">
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
16
|
|
358
|
+
17
|
|
359
|
+
18
|
|
360
|
+
19
|
|
361
|
+
20
|
|
362
|
+
21
|
|
363
|
+
22
|
|
364
|
+
23
|
|
365
|
+
24
|
|
366
|
+
25
|
|
367
|
+
26
|
|
368
|
+
27</pre>
|
|
369
|
+
</td>
|
|
370
|
+
<td>
|
|
371
|
+
<pre class="code"><span class="info file"># File 'app/model/Score.rb', line 16</span>
|
|
372
|
+
|
|
373
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='rparen'>)</span>
|
|
374
|
+
|
|
375
|
+
<span class='comment'>## Crée la table Score
|
|
376
|
+
</span> <span class='cvar'>@@db</span><span class='period'>.</span><span class='id identifier rubyid_execute'>execute</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>CREATE TABLE IF NOT EXISTS score (
|
|
377
|
+
score_id integer primary key autoincrement,
|
|
378
|
+
niveau integer NOT NULL,
|
|
379
|
+
score integer NOT NULL,
|
|
380
|
+
utilisateur integer,
|
|
381
|
+
FOREIGN KEY(utilisateur) REFERENCES utilisateur(utilisateur_id)
|
|
382
|
+
);</span><span class='tstring_end'>"</span></span>
|
|
383
|
+
<span class='ivar'>@difficulte</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
|
384
|
+
<span class='kw'>end</span></pre>
|
|
385
|
+
</td>
|
|
386
|
+
</tr>
|
|
387
|
+
</table>
|
|
388
|
+
</div>
|
|
389
|
+
|
|
390
|
+
</div>
|
|
391
|
+
|
|
392
|
+
<div id="instance_attr_details" class="attr_details">
|
|
393
|
+
<h2>Instance Attribute Details</h2>
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
<span id="difficulte=-instance_method"></span>
|
|
397
|
+
<div class="method_details first">
|
|
398
|
+
<h3 class="signature first" id="difficulte-instance_method">
|
|
399
|
+
|
|
400
|
+
#<strong>difficulte</strong> ⇒ <tt>Object</tt>
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
</h3><div class="docstring">
|
|
407
|
+
<div class="discussion">
|
|
408
|
+
|
|
409
|
+
<p>Returns the value of attribute difficulte</p>
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
</div>
|
|
413
|
+
</div>
|
|
414
|
+
<div class="tags">
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
</div><table class="source_code">
|
|
418
|
+
<tr>
|
|
419
|
+
<td>
|
|
420
|
+
<pre class="lines">
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
11
|
|
424
|
+
12
|
|
425
|
+
13</pre>
|
|
426
|
+
</td>
|
|
427
|
+
<td>
|
|
428
|
+
<pre class="code"><span class="info file"># File 'app/model/Score.rb', line 11</span>
|
|
429
|
+
|
|
430
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_difficulte'>difficulte</span>
|
|
431
|
+
<span class='ivar'>@difficulte</span>
|
|
432
|
+
<span class='kw'>end</span></pre>
|
|
433
|
+
</td>
|
|
434
|
+
</tr>
|
|
435
|
+
</table>
|
|
436
|
+
</div>
|
|
437
|
+
|
|
438
|
+
</div>
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
<div id="instance_method_details" class="method_details_list">
|
|
442
|
+
<h2>Instance Method Details</h2>
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
<div class="method_details first">
|
|
446
|
+
<h3 class="signature first" id="calcul-instance_method">
|
|
447
|
+
|
|
448
|
+
#<strong>calcul</strong>(penalite, tempsChrono) ⇒ <tt>Object</tt>
|
|
449
|
+
|
|
450
|
+
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
</h3><div class="docstring">
|
|
455
|
+
<div class="discussion">
|
|
456
|
+
|
|
457
|
+
<p>Calcule le score du joueur</p>
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
</div>
|
|
461
|
+
</div>
|
|
462
|
+
<div class="tags">
|
|
463
|
+
<p class="tag_title">Parameters:</p>
|
|
464
|
+
<ul class="param">
|
|
465
|
+
|
|
466
|
+
<li>
|
|
467
|
+
|
|
468
|
+
<span class='name'>penalite</span>
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
<span class='type'></span>
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
—
|
|
476
|
+
<div class='inline'>
|
|
477
|
+
<p>Nombre de pénalités</p>
|
|
478
|
+
</div>
|
|
479
|
+
|
|
480
|
+
</li>
|
|
481
|
+
|
|
482
|
+
<li>
|
|
483
|
+
|
|
484
|
+
<span class='name'>tempsChrono</span>
|
|
485
|
+
|
|
486
|
+
|
|
487
|
+
<span class='type'></span>
|
|
488
|
+
|
|
489
|
+
|
|
490
|
+
|
|
491
|
+
—
|
|
492
|
+
<div class='inline'>
|
|
493
|
+
<p>L'état du chrono</p>
|
|
494
|
+
</div>
|
|
495
|
+
|
|
496
|
+
</li>
|
|
497
|
+
|
|
498
|
+
</ul>
|
|
499
|
+
|
|
500
|
+
<p class="tag_title">Returns:</p>
|
|
501
|
+
<ul class="return">
|
|
502
|
+
|
|
503
|
+
<li>
|
|
504
|
+
|
|
505
|
+
|
|
506
|
+
<span class='type'></span>
|
|
507
|
+
|
|
508
|
+
|
|
509
|
+
|
|
510
|
+
|
|
511
|
+
<div class='inline'>
|
|
512
|
+
<p>Score de l'utilisateur</p>
|
|
513
|
+
</div>
|
|
514
|
+
|
|
515
|
+
</li>
|
|
516
|
+
|
|
517
|
+
</ul>
|
|
518
|
+
|
|
519
|
+
</div><table class="source_code">
|
|
520
|
+
<tr>
|
|
521
|
+
<td>
|
|
522
|
+
<pre class="lines">
|
|
523
|
+
|
|
524
|
+
|
|
525
|
+
90
|
|
526
|
+
91
|
|
527
|
+
92
|
|
528
|
+
93
|
|
529
|
+
94
|
|
530
|
+
95
|
|
531
|
+
96
|
|
532
|
+
97
|
|
533
|
+
98</pre>
|
|
534
|
+
</td>
|
|
535
|
+
<td>
|
|
536
|
+
<pre class="code"><span class="info file"># File 'app/model/Score.rb', line 90</span>
|
|
537
|
+
|
|
538
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_calcul'>calcul</span><span class='lparen'>(</span><span class='id identifier rubyid_penalite'>penalite</span><span class='comma'>,</span> <span class='id identifier rubyid_tempsChrono'>tempsChrono</span><span class='rparen'>)</span>
|
|
539
|
+
|
|
540
|
+
<span class='id identifier rubyid_tempsResoluMoy'>tempsResoluMoy</span> <span class='op'>=</span> <span class='int'>3</span><span class='op'>*</span><span class='int'>60</span>
|
|
541
|
+
|
|
542
|
+
<span class='id identifier rubyid_evolutionScore'>evolutionScore</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='id identifier rubyid_tempsResoluMoy'>tempsResoluMoy</span> <span class='op'>-</span> <span class='id identifier rubyid_tempsChrono'>tempsChrono</span><span class='rparen'>)</span> <span class='op'>+</span> <span class='lparen'>(</span><span class='lparen'>(</span><span class='id identifier rubyid_tempsResoluMoy'>tempsResoluMoy</span><span class='op'>/</span><span class='int'>10</span><span class='rparen'>)</span><span class='op'>*</span><span class='lparen'>(</span><span class='int'>20</span> <span class='op'>-</span> <span class='id identifier rubyid_penalite'>penalite</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
|
543
|
+
<span class='id identifier rubyid_scoreCourant'>scoreCourant</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='ivar'>@difficulte</span><span class='rparen'>)</span><span class='op'>*</span><span class='id identifier rubyid_evolutionScore'>evolutionScore</span>
|
|
544
|
+
|
|
545
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_scoreCourant'>scoreCourant</span>
|
|
546
|
+
<span class='kw'>end</span></pre>
|
|
547
|
+
</td>
|
|
548
|
+
</tr>
|
|
549
|
+
</table>
|
|
550
|
+
</div>
|
|
551
|
+
|
|
552
|
+
<div class="method_details ">
|
|
553
|
+
<h3 class="signature " id="creer-instance_method">
|
|
554
|
+
|
|
555
|
+
#<strong>creer</strong>(pseudo, niveau, score) ⇒ <tt>Object</tt>
|
|
556
|
+
|
|
557
|
+
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+
|
|
561
|
+
</h3><div class="docstring">
|
|
562
|
+
<div class="discussion">
|
|
563
|
+
|
|
564
|
+
<p>Crée un score dans la table score pour l'utilisateur</p>
|
|
565
|
+
|
|
566
|
+
|
|
567
|
+
</div>
|
|
568
|
+
</div>
|
|
569
|
+
<div class="tags">
|
|
570
|
+
<p class="tag_title">Parameters:</p>
|
|
571
|
+
<ul class="param">
|
|
572
|
+
|
|
573
|
+
<li>
|
|
574
|
+
|
|
575
|
+
<span class='name'>pseudo</span>
|
|
576
|
+
|
|
577
|
+
|
|
578
|
+
<span class='type'></span>
|
|
579
|
+
|
|
580
|
+
|
|
581
|
+
|
|
582
|
+
—
|
|
583
|
+
<div class='inline'>
|
|
584
|
+
<p>Le pseudo utilisateur</p>
|
|
585
|
+
</div>
|
|
586
|
+
|
|
587
|
+
</li>
|
|
588
|
+
|
|
589
|
+
<li>
|
|
590
|
+
|
|
591
|
+
<span class='name'>niveau</span>
|
|
592
|
+
|
|
593
|
+
|
|
594
|
+
<span class='type'></span>
|
|
595
|
+
|
|
596
|
+
|
|
597
|
+
|
|
598
|
+
—
|
|
599
|
+
<div class='inline'>
|
|
600
|
+
<p>Niveau de difficulté de la partie</p>
|
|
601
|
+
</div>
|
|
602
|
+
|
|
603
|
+
</li>
|
|
604
|
+
|
|
605
|
+
<li>
|
|
606
|
+
|
|
607
|
+
<span class='name'>score</span>
|
|
608
|
+
|
|
609
|
+
|
|
610
|
+
<span class='type'></span>
|
|
611
|
+
|
|
612
|
+
|
|
613
|
+
|
|
614
|
+
—
|
|
615
|
+
<div class='inline'>
|
|
616
|
+
<p>Score</p>
|
|
617
|
+
</div>
|
|
618
|
+
|
|
619
|
+
</li>
|
|
620
|
+
|
|
621
|
+
</ul>
|
|
622
|
+
|
|
623
|
+
<p class="tag_title">Returns:</p>
|
|
624
|
+
<ul class="return">
|
|
625
|
+
|
|
626
|
+
<li>
|
|
627
|
+
|
|
628
|
+
|
|
629
|
+
<span class='type'></span>
|
|
630
|
+
|
|
631
|
+
|
|
632
|
+
|
|
633
|
+
|
|
634
|
+
<div class='inline'>
|
|
635
|
+
<p>Self</p>
|
|
636
|
+
</div>
|
|
637
|
+
|
|
638
|
+
</li>
|
|
639
|
+
|
|
640
|
+
</ul>
|
|
641
|
+
|
|
642
|
+
</div><table class="source_code">
|
|
643
|
+
<tr>
|
|
644
|
+
<td>
|
|
645
|
+
<pre class="lines">
|
|
646
|
+
|
|
647
|
+
|
|
648
|
+
63
|
|
649
|
+
64
|
|
650
|
+
65
|
|
651
|
+
66
|
|
652
|
+
67
|
|
653
|
+
68
|
|
654
|
+
69
|
|
655
|
+
70</pre>
|
|
656
|
+
</td>
|
|
657
|
+
<td>
|
|
658
|
+
<pre class="code"><span class="info file"># File 'app/model/Score.rb', line 63</span>
|
|
659
|
+
|
|
660
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_creer'>creer</span><span class='lparen'>(</span><span class='id identifier rubyid_pseudo'>pseudo</span><span class='comma'>,</span> <span class='id identifier rubyid_niveau'>niveau</span><span class='comma'>,</span> <span class='id identifier rubyid_score'>score</span><span class='rparen'>)</span>
|
|
661
|
+
<span class='comment'>## Récupère id utilisateur
|
|
662
|
+
</span> <span class='id identifier rubyid_req'>req</span> <span class='op'>=</span> <span class='cvar'>@@db</span><span class='period'>.</span><span class='id identifier rubyid_execute'>execute</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>SELECT utilisateur_id FROM utilisateur WHERE pseudo= ?</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_pseudo'>pseudo</span>
|
|
663
|
+
|
|
664
|
+
<span class='id identifier rubyid_insert'>insert</span><span class='lparen'>(</span><span class='symbol'>:utilisateur</span> <span class='op'>=></span> <span class='id identifier rubyid_req'>req</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='symbol'>:niveau</span> <span class='op'>=></span> <span class='id identifier rubyid_niveau'>niveau</span><span class='comma'>,</span> <span class='symbol'>:score</span> <span class='op'>=></span> <span class='id identifier rubyid_score'>score</span><span class='rparen'>)</span>
|
|
665
|
+
|
|
666
|
+
<span class='kw'>return</span> <span class='kw'>self</span>
|
|
667
|
+
<span class='kw'>end</span></pre>
|
|
668
|
+
</td>
|
|
669
|
+
</tr>
|
|
670
|
+
</table>
|
|
671
|
+
</div>
|
|
672
|
+
|
|
673
|
+
<div class="method_details ">
|
|
674
|
+
<h3 class="signature " id="meilleursScores-instance_method">
|
|
675
|
+
|
|
676
|
+
#<strong>meilleursScores</strong>(n) ⇒ <tt>Object</tt>
|
|
677
|
+
|
|
678
|
+
|
|
679
|
+
|
|
680
|
+
|
|
681
|
+
|
|
682
|
+
</h3><div class="docstring">
|
|
683
|
+
<div class="discussion">
|
|
684
|
+
|
|
685
|
+
<p>Récupère les n meilleures scores</p>
|
|
686
|
+
|
|
687
|
+
|
|
688
|
+
</div>
|
|
689
|
+
</div>
|
|
690
|
+
<div class="tags">
|
|
691
|
+
<p class="tag_title">Parameters:</p>
|
|
692
|
+
<ul class="param">
|
|
693
|
+
|
|
694
|
+
<li>
|
|
695
|
+
|
|
696
|
+
<span class='name'>n</span>
|
|
697
|
+
|
|
698
|
+
|
|
699
|
+
<span class='type'></span>
|
|
700
|
+
|
|
701
|
+
|
|
702
|
+
|
|
703
|
+
—
|
|
704
|
+
<div class='inline'>
|
|
705
|
+
<p>Nombre de scores à récupérer</p>
|
|
706
|
+
</div>
|
|
707
|
+
|
|
708
|
+
</li>
|
|
709
|
+
|
|
710
|
+
</ul>
|
|
711
|
+
|
|
712
|
+
<p class="tag_title">Returns:</p>
|
|
713
|
+
<ul class="return">
|
|
714
|
+
|
|
715
|
+
<li>
|
|
716
|
+
|
|
717
|
+
|
|
718
|
+
<span class='type'></span>
|
|
719
|
+
|
|
720
|
+
|
|
721
|
+
|
|
722
|
+
|
|
723
|
+
<div class='inline'>
|
|
724
|
+
<p>Les scores (tableau de hash)</p>
|
|
725
|
+
</div>
|
|
726
|
+
|
|
727
|
+
</li>
|
|
728
|
+
|
|
729
|
+
</ul>
|
|
730
|
+
|
|
731
|
+
</div><table class="source_code">
|
|
732
|
+
<tr>
|
|
733
|
+
<td>
|
|
734
|
+
<pre class="lines">
|
|
735
|
+
|
|
736
|
+
|
|
737
|
+
48
|
|
738
|
+
49
|
|
739
|
+
50
|
|
740
|
+
51
|
|
741
|
+
52</pre>
|
|
742
|
+
</td>
|
|
743
|
+
<td>
|
|
744
|
+
<pre class="code"><span class="info file"># File 'app/model/Score.rb', line 48</span>
|
|
745
|
+
|
|
746
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_meilleursScores'>meilleursScores</span><span class='lparen'>(</span><span class='id identifier rubyid_n'>n</span><span class='rparen'>)</span>
|
|
747
|
+
<span class='id identifier rubyid_req'>req</span> <span class='op'>=</span> <span class='cvar'>@@db</span><span class='period'>.</span><span class='id identifier rubyid_execute2'>execute2</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>SELECT * FROM utilisateur INNER JOIN score ON utilisateur=utilisateur_id ORDER BY score DESC LIMIT ?;</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_n'>n</span>
|
|
748
|
+
|
|
749
|
+
<span class='kw'>return</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_to_h'>to_h</span><span class='lparen'>(</span><span class='id identifier rubyid_req'>req</span><span class='rparen'>)</span>
|
|
750
|
+
<span class='kw'>end</span></pre>
|
|
751
|
+
</td>
|
|
752
|
+
</tr>
|
|
753
|
+
</table>
|
|
754
|
+
</div>
|
|
755
|
+
|
|
756
|
+
<div class="method_details ">
|
|
757
|
+
<h3 class="signature " id="mettreAJour-instance_method">
|
|
758
|
+
|
|
759
|
+
#<strong>mettreAJour</strong>(score_id, score) ⇒ <tt>Object</tt>
|
|
760
|
+
|
|
761
|
+
|
|
762
|
+
|
|
763
|
+
|
|
764
|
+
|
|
765
|
+
</h3><div class="docstring">
|
|
766
|
+
<div class="discussion">
|
|
767
|
+
|
|
768
|
+
<p>Met à jour le score d'un utilisateur</p>
|
|
769
|
+
|
|
770
|
+
|
|
771
|
+
</div>
|
|
772
|
+
</div>
|
|
773
|
+
<div class="tags">
|
|
774
|
+
<p class="tag_title">Parameters:</p>
|
|
775
|
+
<ul class="param">
|
|
776
|
+
|
|
777
|
+
<li>
|
|
778
|
+
|
|
779
|
+
<span class='name'>score_id</span>
|
|
780
|
+
|
|
781
|
+
|
|
782
|
+
<span class='type'></span>
|
|
783
|
+
|
|
784
|
+
|
|
785
|
+
|
|
786
|
+
—
|
|
787
|
+
<div class='inline'>
|
|
788
|
+
<p>Id du score</p>
|
|
789
|
+
</div>
|
|
790
|
+
|
|
791
|
+
</li>
|
|
792
|
+
|
|
793
|
+
<li>
|
|
794
|
+
|
|
795
|
+
<span class='name'>score</span>
|
|
796
|
+
|
|
797
|
+
|
|
798
|
+
<span class='type'></span>
|
|
799
|
+
|
|
800
|
+
|
|
801
|
+
|
|
802
|
+
—
|
|
803
|
+
<div class='inline'>
|
|
804
|
+
<p>Score</p>
|
|
805
|
+
</div>
|
|
806
|
+
|
|
807
|
+
</li>
|
|
808
|
+
|
|
809
|
+
</ul>
|
|
810
|
+
|
|
811
|
+
|
|
812
|
+
</div><table class="source_code">
|
|
813
|
+
<tr>
|
|
814
|
+
<td>
|
|
815
|
+
<pre class="lines">
|
|
816
|
+
|
|
817
|
+
|
|
818
|
+
78
|
|
819
|
+
79
|
|
820
|
+
80</pre>
|
|
821
|
+
</td>
|
|
822
|
+
<td>
|
|
823
|
+
<pre class="code"><span class="info file"># File 'app/model/Score.rb', line 78</span>
|
|
824
|
+
|
|
825
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_mettreAJour'>mettreAJour</span><span class='lparen'>(</span><span class='id identifier rubyid_score_id'>score_id</span><span class='comma'>,</span> <span class='id identifier rubyid_score'>score</span><span class='rparen'>)</span>
|
|
826
|
+
<span class='cvar'>@@db</span><span class='period'>.</span><span class='id identifier rubyid_execute'>execute</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>UPDATE score SET score= ? WHERE score_id = ?</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_score'>score</span><span class='comma'>,</span> <span class='id identifier rubyid_score_id'>score_id</span>
|
|
827
|
+
<span class='kw'>end</span></pre>
|
|
828
|
+
</td>
|
|
829
|
+
</tr>
|
|
830
|
+
</table>
|
|
831
|
+
</div>
|
|
832
|
+
|
|
833
|
+
<div class="method_details ">
|
|
834
|
+
<h3 class="signature " id="scoreUtilisateur-instance_method">
|
|
835
|
+
|
|
836
|
+
#<strong>scoreUtilisateur</strong>(pseudo) ⇒ <tt>Object</tt>
|
|
837
|
+
|
|
838
|
+
|
|
839
|
+
|
|
840
|
+
|
|
841
|
+
|
|
842
|
+
</h3><div class="docstring">
|
|
843
|
+
<div class="discussion">
|
|
844
|
+
|
|
845
|
+
<p>Récupère les scores de l'utilisateur</p>
|
|
846
|
+
|
|
847
|
+
|
|
848
|
+
</div>
|
|
849
|
+
</div>
|
|
850
|
+
<div class="tags">
|
|
851
|
+
<p class="tag_title">Parameters:</p>
|
|
852
|
+
<ul class="param">
|
|
853
|
+
|
|
854
|
+
<li>
|
|
855
|
+
|
|
856
|
+
<span class='name'>pseudo</span>
|
|
857
|
+
|
|
858
|
+
|
|
859
|
+
<span class='type'></span>
|
|
860
|
+
|
|
861
|
+
|
|
862
|
+
|
|
863
|
+
—
|
|
864
|
+
<div class='inline'>
|
|
865
|
+
<p>Pseudo de l'utilisateur</p>
|
|
866
|
+
</div>
|
|
867
|
+
|
|
868
|
+
</li>
|
|
869
|
+
|
|
870
|
+
</ul>
|
|
871
|
+
|
|
872
|
+
<p class="tag_title">Returns:</p>
|
|
873
|
+
<ul class="return">
|
|
874
|
+
|
|
875
|
+
<li>
|
|
876
|
+
|
|
877
|
+
|
|
878
|
+
<span class='type'></span>
|
|
879
|
+
|
|
880
|
+
|
|
881
|
+
|
|
882
|
+
|
|
883
|
+
<div class='inline'>
|
|
884
|
+
<p>Les scores (tableau de hash)</p>
|
|
885
|
+
</div>
|
|
886
|
+
|
|
887
|
+
</li>
|
|
888
|
+
|
|
889
|
+
</ul>
|
|
890
|
+
|
|
891
|
+
</div><table class="source_code">
|
|
892
|
+
<tr>
|
|
893
|
+
<td>
|
|
894
|
+
<pre class="lines">
|
|
895
|
+
|
|
896
|
+
|
|
897
|
+
36
|
|
898
|
+
37
|
|
899
|
+
38
|
|
900
|
+
39</pre>
|
|
901
|
+
</td>
|
|
902
|
+
<td>
|
|
903
|
+
<pre class="code"><span class="info file"># File 'app/model/Score.rb', line 36</span>
|
|
904
|
+
|
|
905
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_scoreUtilisateur'>scoreUtilisateur</span><span class='lparen'>(</span><span class='id identifier rubyid_pseudo'>pseudo</span><span class='rparen'>)</span>
|
|
906
|
+
<span class='id identifier rubyid_req'>req</span> <span class='op'>=</span> <span class='cvar'>@@db</span><span class='period'>.</span><span class='id identifier rubyid_execute2'>execute2</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>SELECT * FROM utilisateur INNER JOIN score ON utilisateur=utilisateur_id WHERE pseudo=?;</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_pseudo'>pseudo</span>
|
|
907
|
+
<span class='kw'>return</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_to_h'>to_h</span><span class='lparen'>(</span><span class='id identifier rubyid_req'>req</span><span class='rparen'>)</span>
|
|
908
|
+
<span class='kw'>end</span></pre>
|
|
909
|
+
</td>
|
|
910
|
+
</tr>
|
|
911
|
+
</table>
|
|
912
|
+
</div>
|
|
913
|
+
|
|
914
|
+
</div>
|
|
915
|
+
|
|
916
|
+
</div>
|
|
917
|
+
|
|
918
|
+
<div id="footer">
|
|
919
|
+
Generated on Sat Apr 22 22:47:30 2017 by
|
|
920
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
921
|
+
0.9.8 (ruby-2.3.3).
|
|
922
|
+
</div>
|
|
923
|
+
|
|
924
|
+
</div>
|
|
925
|
+
</body>
|
|
926
|
+
</html>
|