timequiz 0.2.2 → 0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: daea9447b170a102d8da289d83d0a3308e7978ffd6398f685b3ba38c1a9b8a3e
4
- data.tar.gz: 6d5c7ef90601c861f2c5af709cf6db654e76f7a21b6ef17c5e09889b9aa6e35c
3
+ metadata.gz: 4dfbd11aa927e4fa19f97df85c57fcb4bfbcd54d732629af6a2a97686e1b8725
4
+ data.tar.gz: 5e90386c572b4b33dac75535a3fceea7ac8017ca147af10e0a074664a750f47d
5
5
  SHA512:
6
- metadata.gz: eb8af1641167be90a179d1a659172ec38ebbaeae264c0aa0b32eeb878c1330cab038e8ffcc900c343105297e8265bf28006b8aee7349400a45651bc54fd83824
7
- data.tar.gz: bfd0f786ec2df827c1ceb40968c13fe34c70ddab9c7fca3a1d5fb9fbc00ae3f95fba21ed441dd653ac93c7dda8e85592c3138f7611c3c1d00b4188338e92f618
6
+ metadata.gz: b8dadc3a9eba2c6429771d695a53aabc56cb6d09b47b5fdf902364bd54d02939a3c85b41a201e99b70d211a686322a13791e93508f1db5b7cfbcef32734c95b1
7
+ data.tar.gz: 86b49f8edb20261267fe989d4e51d721966df45576ecbf6dafeb0a975631ee64a169b26c92ea409e6a52b772c02e4cedb2004a528aca300a0bc765fa61c2d184
@@ -1,200 +1,334 @@
1
1
  <?xml version="1.0" encoding="utf-8"?>
2
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
2
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
3
  <head>
5
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
- <meta name="generator" content="Docutils 0.21.2: https://docutils.sourceforge.io/" />
7
- <title>TIMEQUIZ</title>
8
- <style type="text/css">
4
+ <meta name="generator" content=
5
+ "HTML Tidy für Linux, Version 5.8.0" />
6
+ <meta charset="utf-8" />
7
+ <title>Timequiz</title>
8
+ <style type="text/css">
9
+ /*<![CDATA[*/
9
10
 
10
- /*
11
- :Author: Michael Uplawski
12
- :Contact: michael.uplawski@uplawski.eu
13
- :License: WTFPL 2.0, see http://www.wtfpl.net/about/
11
+ /*
12
+ :Author: Michael Uplawski
13
+ :Contact: michael.uplawski@uplawski.eu
14
+ :License: WTFPL 2.0, see http://www.wtfpl.net/about/
14
15
 
15
- Stylesheet for use with Docutils.
16
- */
16
+ Stylesheet for use with Docutils.
17
+ */
17
18
 
18
- /* The defaults for docutils */
19
- @import url(html4css1.css);
20
-
21
- body {
19
+ body {
22
20
  background-color:#200030;
23
21
  font-family: Verdana,Helvetica,Univers;
24
22
  color:#f0f0f0;
25
23
  color:#f0f0f0;
26
- }
27
-
28
- h1 {color:cyan;font-size:1.5em;}
29
- h1.title {color:#a0a0f0;font-size:2em;}
30
- h2 {color:#ffffa0;}
31
-
32
- p, ul.simple, ol.simple, dt {margin-left:2em;}
33
- p.first {font-weight:bold;}
34
- dd {margin-left:4em;}
35
- td {color:#f0f080;}
36
-
37
- /* correct left margin of nested block tags*/
38
- dd p, li p {margin-left:0;}
39
- dd * ul {margin-left:0 ! important; }
40
- dd ul {margin-left:0 ! important; }
41
- dd dl dt, dd dl dd {margin-left:0 ! important;}
42
- dt {font-weight:bold;}
43
- dt, dd {color:#f0f0f0}
44
-
45
- tt.docutils {color:#000080;
24
+ }
25
+
26
+ h1 {color:cyan;font-size:1.5em;}
27
+ h1.title {color:#a0a0f0;font-size:2em;}
28
+ h2 {color:#ffffa0;}
29
+
30
+ p, ul.simple, ol.simple, dt {margin-left:2em;}
31
+ p.first {font-weight:bold;}
32
+ dd {margin-left:4em;}
33
+ table {
34
+ border: 0.5pt dotted #ffa050;
35
+ margin-left:2em;
36
+ border-radius:1em;
37
+ }
38
+ td {color:#f0f080;}
39
+
40
+ /* correct left margin of nested block tags*/
41
+ dd p, li p {margin-left:0;}
42
+ dd * ul {margin-left:0 ! important; }
43
+ dd ul {margin-left:0 ! important; }
44
+ dd dl dt, dd dl dd {margin-left:0 ! important;}
45
+ dt {font-weight:bold;}
46
+ dt, dd {color:#f0f0f0}
47
+
48
+ tt.docutils {color:#000080;
46
49
  background-color:#a080a0;
47
50
  padding-left:3px;
48
51
  padding-right:3px;
49
52
  white-space:nowrap;
50
- }
53
+ }
51
54
 
52
- a.external {color:#ff90ff;}
55
+ a.external {color:#ff90ff;}
53
56
 
54
- blockquote {background-color:#ffc090;
57
+ blockquote {background-color:#ffc090;
55
58
  padding:0.5em;
56
59
  border-radius:0.5em;
57
- }
60
+ }
58
61
 
59
62
 
60
- </style>
63
+ /*]]>*/
64
+ </style>
61
65
  </head>
62
66
  <body>
63
- <div class="document" id="timequiz">
64
- <h1 class="title">TIMEQUIZ</h1>
65
- <h2 class="subtitle" id="play-a-history-quiz-game">Play a history-quiz game</h2>
66
-
67
- <div class="section" id="synopsis">
68
- <h1>SYNOPSIS</h1>
69
- <p>timequiz [options]</p>
70
- <p>Run timequiz without any options to begin a quiz using the default set of
71
- historical events—the provided collection is modest in size.</p>
72
- </div>
73
- <div class="section" id="description">
74
- <h1>DESCRIPTION</h1>
75
- <p>The game presents a limited number of historical events (currently three) in
76
- random order. Your task is to correctly arrange them chronologically. In each
77
- subsequent round, a single new event appears—you must place it in the correct
78
- position relative to the previously ordered events (either before one of the
79
- listed events or later).</p>
80
- <p>After every round—including the first—your performance is assessed. You may
81
- then choose to proceed with another event or review the brief description of
82
- any event already in the sequence.</p>
83
- <p>The game continues until you press q to quit or until the maximum of 15 events
84
- have been played.</p>
85
- <div class="section" id="you-dont-need-to-know-every-date">
86
- <h2>YOU DON’T NEED TO KNOW EVERY DATE</h2>
87
- <p>Winning often does not require exact historical knowledge. Instead, logical
88
- reasoning or educated guesses—eliminating events that are clearly too early or
89
- too lateusually suffices. Reading the event descriptions may also help you
90
- situate other events in historical context later on.</p>
91
- </div>
92
- </div>
93
- <div class="section" id="options-not-needed-to-play">
94
- <h1>OPTIONS (not needed to play)</h1>
95
- <p><strong>-a, --add</strong> Add a new event to the game</p>
96
- <p><strong>-e, --event</strong> [EVENT] Provide a name of the new event</p>
97
- <p><strong>-y, --year</strong> [YEAR] Specify the year of the new event</p>
98
- <p><strong>-b, --background</strong> [INFO] Supply background information for the new event</p>
99
- <p><strong>-f, --file</strong> [FILE] Specify the file for reading/writing events</p>
100
- <p><strong>-d, --debug</strong> Enable verbose debug output</p>
101
- <p><strong>-v, --version</strong> Display program version</p>
102
- <p><strong>-h, --help</strong> Show help message</p>
103
- <div class="section" id="the-options-in-detail">
104
- <h2>The Options in detail:</h2>
105
- <dl class="docutils">
106
- <dt>-a --add</dt>
107
- <dd>Requires -e, -y, and -f. This redundancy may be removed in future versions.</dd>
108
- <dt>-e --event [EVENT]</dt>
109
- <dd>The name of the event to add. Requires --add, --year, and --file. Use quotes
110
- for multi-word events, e.g., --event &quot;Some Guy Was Born and Something Broke&quot;.</dd>
111
- <dt>-y --year [YEAR]</dt>
112
- <dd>The year of the event, e.g., -y 1244.</dd>
113
- <dt>-b --background [INFO]</dt>
114
- <dd>Optional context to help with the quiz—use sparingly. For example: -b &quot;The
115
- phenomenon was of no significance whatsoever&quot;.</dd>
116
- <dt>-f --file [FILE]</dt>
117
- <dd>Path to the events file used for quizzes or for adding new events. If the file
118
- does not exist, it is created with some sample events. It must be readable for
119
- quizzes and writable for additions.</dd>
120
- <dt>-d --debug</dt>
121
- <dd>Enables verbose debugging output. Mainly useful for developers.</dd>
122
- <dt>-v --version</dt>
123
- <dd>Display the current version of the program.</dd>
124
- <dt>-h --help</dt>
125
- <dd>Show this list of options and usage instructions.</dd>
126
- </dl>
127
- </div>
128
- </div>
129
- <div class="section" id="game-example">
130
- <h1>GAME EXAMPLE</h1>
131
- <p>Launching timequiz with no options displays three random historical events,
132
- prompting:</p>
133
- <table border="1" class="docutils">
134
- <colgroup>
135
- <col width="100%" />
136
- </colgroup>
137
- <tbody valign="top">
138
- <tr><td><p class="first">Put the following events into the right chronological order (e.g.: 2 3 1).</p>
139
- <ol class="arabic simple">
140
- <li>The Roman emperor Diocletian devides the empire in two</li>
141
- <li>End of the &quot;War of the mercenaries&quot;</li>
142
- <li>Destruction of Nimrod and Ninive by the Medians and Neo-Babylonians</li>
143
- </ol>
144
- <p class="last">Available: 1, 2, 3)</p>
145
- </td>
146
- </tr>
147
- </tbody>
148
- </table>
149
- <p>Enter your sequence (e.g., 321) without needing to press Enter after each
150
- number. The game then shows the correct order with years and evaluates your
151
- input. You’ll be asked if you wish to continue with a new event or view more
152
- info on the listed events.</p>
153
- <table border="1" class="docutils">
154
- <colgroup>
155
- <col width="100%" />
156
- </colgroup>
157
- <tbody valign="top">
158
- <tr><td>Enter number for more information about an event, 'a' to play with one new, random event, 'q' to quit.</td>
159
- </tr>
160
- </tbody>
161
- </table>
162
- <p>To continue:</p>
163
- <p>Press a number to view an event’s details,</p>
164
- <p>a to add a new random event, or</p>
165
- <p>q to quit.</p>
166
- <p>If you choose a, here’s how the next prompt may appear:</p>
167
- <table border="1" class="docutils">
168
- <colgroup>
169
- <col width="100%" />
170
- </colgroup>
171
- <tbody valign="top">
172
- <tr><td><p class="first">Indicate the event from the previous list, which precedes the following, or '0' (zero) to put it in front:</p>
173
- <p class="last">The Italian painter Lorenzo Lotto dies.</p>
174
- </td>
175
- </tr>
176
- </tbody>
177
- </table>
178
- <p>You must then enter the corresponding number or 0 if you believe that the event
179
- occurred before all listed events (which, in this case, would be historically
180
- inaccurate). Press Enter to submit your answer.</p>
181
- </div>
182
- <div class="section" id="additional-information">
183
- <h1>ADDITIONAL INFORMATION</h1>
184
- <dl class="docutils">
185
- <dt>Development &amp; Source Code</dt>
186
- <dd>timequiz is written in Ruby. As it's interpreted, the executable is
187
- essentially the source code—you can open it in any text editor. If installed
188
- from a Ruby gem, you can extract it using <tt class="docutils literal">tar <span class="pre">-x</span></tt>, then <tt class="docutils literal">tar <span class="pre">-xzf</span></tt>.</dd>
189
- <dt>Known Bug</dt>
190
- <dd>At times, the list of events may wrap incorrectly in the display.</dd>
191
- <dt>License</dt>
192
- <dd>Distributed under the GNU General Public License (GPL) version 3.</dd>
193
- <dt>Author</dt>
194
- <dd>Developed by Michael Uplawski &lt;<a class="reference external" href="mailto:michael.uplawski&#64;uplawski.eu">michael.uplawski&#64;uplawski.eu</a>&gt;</dd>
195
- </dl>
196
- <p>Ω</p>
197
- </div>
198
- </div>
67
+ <main id="timequiz">
68
+ <h1 class="title">TIMEQUIZ</h1>
69
+
70
+ <p class="subtitle" id="play-a-history-quiz-game">Play a
71
+ history-quiz game</p>
72
+
73
+ <section id="synopsis">
74
+ <h2>SYNOPSIS</h2>
75
+
76
+ <p>timequiz [options]</p>
77
+
78
+ <p>Run timequiz without any options to begin a quiz using the
79
+ default set of historical events—the provided collection is
80
+ modest in size.</p>
81
+ </section>
82
+
83
+ <section id="description">
84
+ <h2>DESCRIPTION</h2>
85
+
86
+ <p>The game presents a limited number of historical events
87
+ (currently three) in random order. Your task is to correctly
88
+ arrange them chronologically. In each subsequent round, a
89
+ single new event appears—you must place it in the correct
90
+ position relative to the previously ordered events (either
91
+ before one of the listed events or later).</p>
92
+
93
+ <p>After every roundincluding the first—your performance is
94
+ assessed. You may then choose to proceed with another event
95
+ or review the brief description of any event already in the
96
+ sequence.</p>
97
+
98
+ <p>The game continues until you press q to quit or until the
99
+ maximum of 15 events have been played.</p>
100
+
101
+ <section id="you-dont-need-to-know-every-date">
102
+ <h3>YOU DON’T NEED TO KNOW EVERY DATE</h3>
103
+
104
+ <p>Winning often does not require exact historical
105
+ knowledge. Instead, logical reasoning or educated
106
+ guesses—eliminating events that are clearly too early or
107
+ too late—usually suffices. Reading the event descriptions
108
+ may also help you situate other events in historical
109
+ context later on.</p>
110
+ </section>
111
+ </section>
112
+
113
+ <section id="options-not-needed-to-play">
114
+ <h2>OPTIONS (not needed to play)</h2>
115
+
116
+ <p><strong>-a, --add</strong> Add a new event to the game</p>
117
+
118
+ <p><strong>-e, --event</strong> [EVENT] Provide a name of the
119
+ new event</p>
120
+
121
+ <p><strong>-y, --year</strong> [YEAR] Specify the year of the
122
+ new event</p>
123
+
124
+ <p><strong>-b, --background</strong> [INFO] Supply background
125
+ information for the new event</p>
126
+
127
+ <p><strong>-f, --file</strong> [FILE] Specify the file for
128
+ reading/writing events</p>
129
+
130
+ <p><strong>-d, --debug</strong> Enable verbose debug
131
+ output</p>
132
+
133
+ <p><strong>-v, --version</strong> Display program version</p>
134
+
135
+ <p><strong>-h, --help</strong> Show help message</p>
136
+
137
+ <section id="the-options-in-detail">
138
+ <h3>The Options in detail:</h3>
139
+
140
+ <dl class="simple">
141
+ <dt>-a --add</dt>
142
+
143
+ <dd>
144
+ <p>Requires -e, -y, and -f. This redundancy may be
145
+ removed in future versions.</p>
146
+ </dd>
147
+
148
+ <dt>-e --event [EVENT]</dt>
149
+
150
+ <dd>
151
+ <p>The name of the event to add. Requires --add,
152
+ --year, and --file. Use quotes for multi-word events,
153
+ e.g., --event "Some Guy Was Born and Something
154
+ Broke".</p>
155
+ </dd>
156
+
157
+ <dt>-y --year [YEAR]</dt>
158
+
159
+ <dd>
160
+ <p>The year of the event, e.g., -y 1244.</p>
161
+ </dd>
162
+
163
+ <dt>-b --background [INFO]</dt>
164
+
165
+ <dd>
166
+ <p>Optional context to help with the quiz—use
167
+ sparingly. For example: -b "The phenomenon was of no
168
+ significance whatsoever".</p>
169
+ </dd>
170
+
171
+ <dt>-f --file [FILE]</dt>
172
+
173
+ <dd>
174
+ <p>Path to the events file used for quizzes or for
175
+ adding new events. If the file does not exist, it is
176
+ created with some sample events. It must be readable
177
+ for quizzes and writable for additions.</p>
178
+ </dd>
179
+
180
+ <dt>-d --debug</dt>
181
+
182
+ <dd>
183
+ <p>Enables verbose debugging output. Mainly useful for
184
+ developers.</p>
185
+ </dd>
186
+
187
+ <dt>-v --version</dt>
188
+
189
+ <dd>
190
+ <p>Display the current version of the program.</p>
191
+ </dd>
192
+
193
+ <dt>-h --help</dt>
194
+
195
+ <dd>
196
+ <p>Show this list of options and usage
197
+ instructions.</p>
198
+ </dd>
199
+ </dl>
200
+ </section>
201
+ </section>
202
+
203
+ <section id="game-example">
204
+ <h2>GAME EXAMPLE</h2>
205
+
206
+ <p>Launching timequiz with no options displays three random
207
+ historical events, prompting:</p>
208
+
209
+ <table>
210
+ <tbody>
211
+ <tr>
212
+ <td>
213
+ <p>Put the following events into the right
214
+ chronological order (e.g.: 2 3 1).</p>
215
+
216
+ <ol class="arabic simple">
217
+ <li>
218
+ <p>The Roman emperor Diocletian devides the
219
+ empire in two</p>
220
+ </li>
221
+
222
+ <li>
223
+ <p>End of the "War of the mercenaries"</p>
224
+ </li>
225
+
226
+ <li>
227
+ <p>Destruction of Nimrod and Ninive by the
228
+ Medians and Neo-Babylonians</p>
229
+ </li>
230
+ </ol>
231
+
232
+ <p>Available: 1, 2, 3)</p>
233
+ </td>
234
+ </tr>
235
+ </tbody>
236
+ </table>
237
+
238
+ <p>Enter your sequence (e.g., 321) without needing to press
239
+ Enter after each number. The game then shows the correct
240
+ order with years and evaluates your input. You’ll be asked if
241
+ you wish to continue with a new event or view more info on
242
+ the listed events.</p>
243
+
244
+ <table>
245
+ <tbody>
246
+ <tr>
247
+ <td>
248
+ <p>Enter number for more information about an event,
249
+ 'a' to play with one new, random event, 'q' to
250
+ quit.</p>
251
+ </td>
252
+ </tr>
253
+ </tbody>
254
+ </table>
255
+
256
+ <p>To continue:</p>
257
+
258
+ <p>Press a number to view an event’s details,</p>
259
+
260
+ <p>a to add a new random event, or</p>
261
+
262
+ <p>q to quit.</p>
263
+
264
+ <p>If you choose a, here’s how the next prompt may
265
+ appear:</p>
266
+
267
+ <table>
268
+ <tbody>
269
+ <tr>
270
+ <td>
271
+ <p>Indicate the event from the previous list, which
272
+ precedes the following, or '0' (zero) to put it in
273
+ front:</p>
274
+
275
+ <p>The Italian painter Lorenzo Lotto dies.</p>
276
+ </td>
277
+ </tr>
278
+ </tbody>
279
+ </table>
280
+
281
+ <p>You must then enter the corresponding number or 0 if you
282
+ believe that the event occurred before all listed events
283
+ (which, in this case, would be historically inaccurate).
284
+ Press Enter to submit your answer.</p>
285
+ </section>
286
+
287
+ <section id="additional-information">
288
+ <h2>ADDITIONAL INFORMATION</h2>
289
+
290
+ <dl class="simple">
291
+ <dt>Development &amp; Source Code</dt>
292
+
293
+ <dd>
294
+ <p>timequiz is written in Ruby. As it's interpreted, the
295
+ executable is essentially the source code—you can open it
296
+ in any text editor. If installed from a Ruby gem, you can
297
+ extract it using <span class="docutils literal">tar
298
+ <span class="pre">-x</span></span>, then <span class=
299
+ "docutils literal">tar <span class=
300
+ "pre">-xzf</span></span>.</p>
301
+ </dd>
302
+
303
+ <dt>Known Bug</dt>
304
+
305
+ <dd>
306
+ <p>At times, the list of events may wrap incorrectly in
307
+ the display.</p>
308
+ </dd>
309
+
310
+ <dt>License</dt>
311
+
312
+ <dd>
313
+ <p>Timequiz is distributed under the WTFPL-2.0 or later
314
+ License. For more details, visit <a class=
315
+ "reference external" href=
316
+ "http://www.wtfpl.net/txt/copying/">http://www.wtfpl.net/txt/copying/</a></p>
317
+ </dd>
318
+
319
+ <dt>Author</dt>
320
+
321
+ <dd>
322
+ <p>Developed by Michael Uplawski &lt;<a class=
323
+ "reference external" href=
324
+ "mailto:michael.uplawski@uplawski.eu">michael.uplawski@uplawski.eu</a>&gt;</p>
325
+ </dd>
326
+ </dl>
327
+ </section>
328
+
329
+ <section id="section-1">
330
+ <h2>Ω</h2>
331
+ </section>
332
+ </main>
199
333
  </body>
200
334
  </html>
Binary file
data/doc/pdf/timequiz.pdf CHANGED
Binary file
data/doc/rst/timequiz.rst CHANGED
@@ -141,9 +141,11 @@ Known Bug
141
141
  At times, the list of events may wrap incorrectly in the display.
142
142
 
143
143
  License
144
- Distributed under the GNU General Public License (GPL) version 3.
144
+ Timequiz is distributed under the WTFPL-2.0 or later License.
145
+ For more details, visit http://www.wtfpl.net/txt/copying/
145
146
 
146
147
  Author
147
148
  Developed by Michael Uplawski <michael.uplawski@uplawski.eu>
148
149
 
149
150
  Ω
151
+ ============
data/lib/adder.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  #encoding: UTF-8
3
3
  =begin
4
4
  /***************************************************************************
5
- * ©2017-2024, Michael Uplawski <michael.uplawski@uplawski.eu> *
5
+ * ©2017-2025, Michael Uplawski <michael.uplawski@uplawski.eu> *
6
6
  * *
7
7
  * This program is free software; you can redistribute it and/or modify *
8
8
  * it under the terms of the WTFPL 2.0 or later, see *
@@ -22,13 +22,16 @@ require_relative 'basic_logging'
22
22
  class Adder
23
23
  #@@events_file = File.dirname(__FILE__) << File::Separator << 'events.rb'
24
24
  #@@events_backup = File.dirname(__FILE__) << File::Separator << 'bak_events.rb'
25
- include BasicLogging
26
25
 
26
+ self::extend BasicLogging
27
+
27
28
  def self::add(options)
28
29
  debug('options are ' << options.to_s)
29
30
  if options.file
30
31
  @@events_file = options.file
31
- @@events_backup = File.dirname(@@events_file) << File::Separator << 'bak_' << File.basename(@@events_file)
32
+ if(File::exist?(@@events_file) )
33
+ @@events_backup = File.dirname(@@events_file) << File::Separator << 'bak_' << File.basename(@@events_file)
34
+ end
32
35
  else
33
36
  error('To add events, you must name a file on the command-line. Aborting')
34
37
  exit false
data/lib/console.rb CHANGED
@@ -16,12 +16,14 @@
16
16
  require_relative 'extstring'
17
17
  require_relative 'user_input'
18
18
  require_relative 'constants'
19
+ require_relative 'basic_logging'
19
20
 
20
21
  # Functions which create a user-interface in the terminal
21
22
  module Console
23
+ include BasicLogging
24
+
22
25
  # Some definitions which may change one day, become configurable one day,
23
26
  # need to be accessed (one day) from somewhere else or not.
24
-
25
27
  @@won_text = %q"__ __ _ __ __
26
28
  \ \/ /___ __ __ | | / /___ ____ / /
27
29
  \ / __ \/ / / / | | /| / / __ \/ __ \ / /
@@ -41,7 +43,7 @@ module Console
41
43
  def start_game
42
44
  available = $events
43
45
  clear
44
- puts bold("\nPut the following events into the right chronological order (e.g.: 2 3 1).")
46
+ puts bold("\nPut the following events into the correct chronological order (e.g.: 2 3 1).")
45
47
  @m_events = Array.new
46
48
  out = ''
47
49
  $num_events.times do |i|
@@ -80,6 +82,7 @@ module Console
80
82
  end
81
83
  if('a' == ui)
82
84
  ev = new_event
85
+ # all known events have been handled.
83
86
  if ev == :all_events_done
84
87
  score(@@points, true)
85
88
  exit true
@@ -112,7 +115,7 @@ module Console
112
115
  else
113
116
  lose
114
117
  end
115
- score(@@points)
118
+ score(@@points, @m_events.length == $MAX_NUM_EVENTS)
116
119
  else
117
120
  detail( a2i(ui) )
118
121
  end
@@ -166,6 +169,7 @@ module Console
166
169
 
167
170
  def score(pts, all_done = false)
168
171
  intro = (all_done ? 'Final score' : 'Current score')
172
+ debug('all_done? ' << all_done.to_s)
169
173
  puts ' (' << intro << ': %i %s)' %[pts, (pts == 1 ? 'point' : 'points')]
170
174
  end
171
175
 
@@ -178,7 +182,7 @@ module Console
178
182
  end
179
183
 
180
184
  def show_correct_order
181
- cmt = "\tThe right order is:\n" << @m_events.collect {|ev| (@m_events.index(ev) + 1).to_s << ') ' << ev.title << ' (' << ev.year.to_s << ')'}.join("\n").box()
185
+ cmt = "\tThe correct order is:\n" << @m_events.collect {|ev| (@m_events.index(ev) + 1).to_s << ') ' << ev.title << ' (' << ev.year.to_s << ')'}.join("\n").box()
182
186
  wait(@@wait_sequence, 1, cmt)
183
187
  end
184
188
 
@@ -205,7 +209,7 @@ module Console
205
209
  def compare_order(response)
206
210
  puts "\n... You say: " << bold(response.join(', '))
207
211
  devents = @m_events.dup.sort {|f, s| f.year <=> s.year }
208
- cmt = "\tThe right order is:\n" << devents.collect {|ev| ev.disp_index.to_s << ') ' << ev.year.to_s }.join("\n").box()
212
+ cmt = "\tThe correct order is:\n" << devents.collect {|ev| ev.disp_index.to_s << ') ' << ev.year.to_s }.join("\n").box()
209
213
  wait(@@wait_sequence, 1, cmt)
210
214
  end
211
215
 
data/lib/events.rb CHANGED
@@ -15,6 +15,11 @@
15
15
  =end
16
16
 
17
17
  # All events known.
18
+ $events << ['Howard Hughes founds his own aircraft company', 1932,'Hughes was an American manufacturer, aviator, and motion-picture producer and director who acquired enormous wealth and celebrity from his various ventures but was perhaps better known for his eccentricities, especially his reclusiveness (britannica.com).' ]
19
+ $events << ['Destruction of the German town Dresden', 1945,'The bombing on February 1945 caused a firestorm which left the town ablaze for weeks and killed about 35000 people although the precise number will probably never be established.' ]
20
+ $events << ['The aviator Charles Lindbergh dies', 1974,'Charles Lindbergh was the first aviator to complete a solo transatlantic flight in May 1927.' ]
21
+ $events << ['The antropologist Claude Lévi-Strauss is born', 1908,'Lévi-Strauss argued that the "savage" mind had the same structures as the "civilized" mind and that human characteristics are the same everywhere. He received numerous honors from universities and institutions throughout the world.' ]
22
+ $events << ['Napoleon Bonaparte dies', 1821,'Napoleon Bonaparte died at 5.49pm on 5 May 1821, at Longwood on the island of Saint Helena. An autopsy was carried out on 6 May; a preliminary cast for a death mask was taken on 7 May; and on 9 May the Emperor was buried, in the presence of French and English witnesses. Yet since the nineteenth century, mystery and myths have shrouded Napoleon’s death, and the events and people that surrounded it (napoleon.org).' ]
18
23
  $events << ['First hydrogen bomb', 1952,'The first test bomb was called the Ivy Mike device. It was not a deliverable bomb- it weighed 82 tons and used an Atomic bomb to trigger the hydrogen explosion. The bomb was set off on Eniwetok atoll on November 1st. The weapon was 10.4 megatons- 1,000 times stronger than the bomb that destroyed Hiroshima. It was twice the power of all the bombs dropped during World War II.' ]
19
24
  $events << ['Publication of the theory of Special Relativity by Albert Einstein', 1905, "Einstein postulated in his study that the speed of light is immutable, constant, and independent of the observer's motion. Therefore, except the constant speed of light, everything is relative, including time, distance, and mass."]
20
25
  $events << ['The mass of the Earth is estimated for the first time.', 1775, 'Nevil Maskelyne’s experiment on the Scottish mountain Schiehallion set out to derive the mean density of the Earth, from astronomical observations of the deflection of the vertical and calculation of the mountain’s relative gravitational attraction. His results were later amended by the works of Charles Hutton.']
data/lib/version.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  =begin
4
4
  /***************************************************************************
5
- * ©2017-2024, Michael Uplawski <michael.uplawski@uplawski.eu> *
5
+ * ©2017-2025, Michael Uplawski <michael.uplawski@uplawski.eu> *
6
6
  * *
7
7
  * This program is free software; you can redistribute it and/or modify *
8
8
  * it under the terms of the WTFPL 2.0 or later, see *
@@ -15,8 +15,8 @@
15
15
  ***************************************************************************/
16
16
  =end
17
17
 
18
- VERSION = '0.2.2'
19
- SUMMARY = 'New documentation- and homepage URIs.'
18
+ VERSION = '0.3'
19
+ SUMMARY = 'Adder: logging and file-operations corrected'
20
20
  AUTHOR = 'Michael Uplawski'
21
21
  AUTHOR_MAIL = '<michael.uplawski@uplawski.eu>'
22
22
  YEARS = 2017 - 2025
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: timequiz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: '0.3'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Uplawski
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-08-27 00:00:00.000000000 Z
10
+ date: 2025-11-08 00:00:00.000000000 Z
11
11
  dependencies: []
12
12
  description: Play a history game
13
13
  email: michael.uplawski@uplawski.eu
@@ -59,5 +59,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
59
59
  requirements: []
60
60
  rubygems_version: 3.6.7
61
61
  specification_version: 4
62
- summary: New documentation- and homepage URIs.
62
+ summary: 'Adder: logging and file-operations corrected'
63
63
  test_files: []