icoa-cli 2.19.36 → 2.19.37
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.
- package/dist/commands/exam.js +26 -14
- package/package.json +1 -1
package/dist/commands/exam.js
CHANGED
|
@@ -183,17 +183,29 @@ function printHowToPlay() {
|
|
|
183
183
|
console.log(chalk.gray(' ru · hi · de · id · th · vi · tr'));
|
|
184
184
|
console.log(chalk.gray(' ─────────────────────────────────────────'));
|
|
185
185
|
}
|
|
186
|
-
// Australian easter eggs
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
186
|
+
// Australian easter eggs at percentage-based positions. The messages were
|
|
187
|
+
// originally written for a 15-question exam; we now map them by percentage
|
|
188
|
+
// so they fire at the right moment regardless of question count (10 or 15).
|
|
189
|
+
function getEasterEgg(current, total) {
|
|
190
|
+
const EGGS = [
|
|
191
|
+
{ pct: 0.20, emoji: '🏛️', key: 'egg3' }, // Great start
|
|
192
|
+
{ pct: 0.33, emoji: '🐨', key: 'egg5' }, // 1/3 done
|
|
193
|
+
{ pct: 0.50, emoji: '🌉', key: 'egg7' }, // Keep going (halfway)
|
|
194
|
+
{ pct: 0.60, emoji: '🦘', key: 'egg9' }, // Past halfway
|
|
195
|
+
{ pct: 0.80, emoji: '🏖️', key: 'egg11' }, // Almost there
|
|
196
|
+
{ pct: 0.87, emoji: '🦈', key: 'egg13' }, // 2 more to go
|
|
197
|
+
{ pct: 1.00, emoji: '🎉', key: 'egg15' }, // All done
|
|
198
|
+
];
|
|
199
|
+
const seen = new Set();
|
|
200
|
+
for (const egg of EGGS) {
|
|
201
|
+
const targetQ = Math.round(egg.pct * total);
|
|
202
|
+
if (targetQ < 1 || seen.has(targetQ))
|
|
203
|
+
continue;
|
|
204
|
+
seen.add(targetQ);
|
|
205
|
+
if (current === targetQ)
|
|
206
|
+
return { emoji: egg.emoji, text: t(egg.key) };
|
|
207
|
+
}
|
|
208
|
+
return undefined;
|
|
197
209
|
}
|
|
198
210
|
function printQuestionProgress(current, total, answered) {
|
|
199
211
|
const width = 30;
|
|
@@ -220,9 +232,9 @@ function printQuestion(q, answer) {
|
|
|
220
232
|
const eliminated = help.eliminated[q.number] || [];
|
|
221
233
|
// Progress bar
|
|
222
234
|
printQuestionProgress(q.number, total, answered);
|
|
223
|
-
// Easter egg
|
|
224
|
-
const egg =
|
|
225
|
-
if (egg
|
|
235
|
+
// Easter egg (position calculated by percentage of total)
|
|
236
|
+
const egg = getEasterEgg(q.number, total);
|
|
237
|
+
if (egg) {
|
|
226
238
|
console.log(chalk.yellow(` ${egg.emoji} ${egg.text}`));
|
|
227
239
|
}
|
|
228
240
|
console.log();
|