diff --git a/src/lib/Modal.svelte b/src/lib/Modal.svelte
index f7f6c13..eccfec2 100644
--- a/src/lib/Modal.svelte
+++ b/src/lib/Modal.svelte
@@ -4,6 +4,7 @@
import { fly } from 'svelte/transition';
export let value: number;
export let message: string;
+ export let link: string | undefined = undefined;
export let guessType: GuessType;
let visible = false;
@@ -36,6 +37,17 @@
class:bg-gray-200={guessType === GuessType.technicallyIncorrect}
>
{value}
+ {#if link}
+ •
+
+ More info
+ {/if}
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index f37019c..23db778 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -13,7 +13,7 @@
export let data;
let guesses = 0;
- let modals = new Array<{ value: number; message: string; guessType: GuessType }>();
+ let modals = new Array<{ value: number; message: string; link?: string; guessType: GuessType }>();
let numbersEl: HTMLDivElement;
let numbersCount = Object.keys(data.numbers).length;
let startTime = performance.now();
@@ -65,14 +65,14 @@
let guess = (e.target as HTMLInputElement).valueAsNumber;
(e.target as HTMLInputElement).value = '';
- let alreadyGuessedNumber = data.numbers
- .concat(data.technicallyIncorrectNumbers)
- .find(({ value, guessed }) => value === guess && guessed);
- if (alreadyGuessedNumber) {
+ if (
+ data.numbers.some(({ value, guessed }) => value === guess && guessed) ||
+ data.technicallyIncorrectNumbers.some(({ value, guessed }) => value === guess && guessed)
+ ) {
modals = [
...modals,
{
- value: alreadyGuessedNumber.value,
+ value: guess,
message: 'You have already guessed this number.',
guessType: GuessType.technicallyIncorrect
}
@@ -87,7 +87,8 @@
modals = [
...modals,
{
- ...technicallyIncorrectNumber,
+ value: technicallyIncorrectNumber.value,
+ message: technicallyIncorrectNumber.message,
guessType: GuessType.technicallyIncorrect
}
];
@@ -101,6 +102,7 @@
{
value: number.value,
message: number.message,
+ link: number.link,
guessType: GuessType.correct
}
];
diff --git a/src/routes/+page.ts b/src/routes/+page.ts
index 2a61365..3fa100a 100644
--- a/src/routes/+page.ts
+++ b/src/routes/+page.ts
@@ -2,91 +2,157 @@ const numbers = [
{
value: 1970,
message:
- 'The UNIX epoch year and universal computer time representation. One of the first magic numbers you learn in computer science.',
- guessed: false
+ 'The UNIX epoch year for universal computer time representation. One of the first magic numbers you learn in computer science.',
+ guessed: false,
+ link: 'https://en.wikipedia.org/wiki/Unix_time'
},
{
value: 192168,
message: 'The most commonly used private IPv4 address range, formally 192.168.0.0/16.',
- guessed: false
+ guessed: false,
+ link: 'https://en.wikipedia.org/wiki/Private_network#Private_IPv4_addresses'
+ },
+ {
+ value: 1337,
+ message: '"Leet", in hacker speech.',
+ guessed: false,
+ link: 'https://en.wikipedia.org/wiki/Leet'
},
- { value: 1337, message: '"Leet", in hacker speech.', guessed: false },
{
value: 754,
message: 'The IEEE standard for floating-point arithmetic used by every modern computer.',
- guessed: false
+ guessed: false,
+ link: 'https://en.wikipedia.org/wiki/IEEE_754'
},
{
value: 8086,
message: 'The Intel 8086, the first microprocessor with the now-widespread x86 architecture.',
- guessed: false
+ guessed: false,
+ link: 'https://en.wikipedia.org/wiki/Intel_8086'
},
{
value: 214748,
message:
'2^31 - 1 truncated, or the maximum value for a 32-bit signed binary integer. Also a common hard limit in video games.',
- guessed: false
+ guessed: false,
+ link: 'https://en.wikipedia.org/wiki/2147483647'
},
{
value: 418,
message: 'The HTTP status code for "I\'m a teapot", an April Fools\' joke by the IETF.',
- guessed: false
+ guessed: false,
+ link: 'https://en.wikipedia.org/wiki/Hyper_Text_Coffee_Pot_Control_Protocol'
+ },
+ {
+ value: 443,
+ message: 'The default port for HTTPS.',
+ guessed: false,
+ link: 'https://en.wikipedia.org/wiki/HTTPS#Difference_from_HTTP'
},
- { value: 443, message: 'The default port for HTTPS.', guessed: false },
{
value: 414141,
message:
- '"AAA" in hexadecimal, a string often used in buffer overflow attacks or other security exploits.',
- guessed: false
+ '"AAA ..." in hexadecimal, a string often used in buffer overflow attacks or other security exploits.',
+ guessed: false,
+ link: 'https://en.wikipedia.org/wiki/Buffer_overflow'
+ },
+ {
+ value: 44100,
+ message: 'The standard sampling rate for digital and analog audio.',
+ guessed: false,
+ link: 'https://en.wikipedia.org/wiki/44,100_Hz'
},
- { value: 44100, message: 'The standard sample rate for analog audio CDs.', guessed: false },
{
value: 3301,
message: 'The Cicada 3301 internet mystery, popularized by LEMMiNO.',
- guessed: false
+ guessed: false,
+ link: 'https://en.wikipedia.org/wiki/Cicada_3301'
+ },
+ {
+ value: 9600,
+ message: 'A common baud rate for serial communication.',
+ guessed: false,
+ link: 'https://en.wikipedia.org/wiki/Baud'
+ },
+ {
+ value: 80211,
+ message: 'The IEEE standard for wireless networking, or Wi-Fi.',
+ guessed: false,
+ link: 'https://en.wikipedia.org/wiki/IEEE_802.11'
},
- { value: 9600, message: 'A common baud rate for serial communication.', guessed: false },
- { value: 80211, message: 'The IEEE standard for wireless networking, or Wi-Fi.', guessed: false },
{
value: 400000,
- message: 'The base memory address for Linux executables in hexadecimal.',
- guessed: false
+ message: 'The base virtual memory address for Linux executables in hexadecimal.',
+ guessed: false,
+ link: 'https://en.wikipedia.org/wiki/Virtual_memory'
},
{
value: 25519,
message: 'Curve25519, a widely used elliptic curve in cryptography and key exchange.',
- guessed: false
+ guessed: false,
+ link: 'https://en.wikipedia.org/wiki/Curve25519'
},
{
value: 264,
message: 'H.264 or Advanced Video Coding, a common video compression standard.',
- guessed: false
+ guessed: false,
+ link: 'https://en.wikipedia.org/wiki/Advanced_Video_Coding'
},
{
value: 509,
message: 'The X.509 ITU certificate standard, used in TLS and SSL.',
- guessed: false
+ guessed: false,
+ link: 'https://en.wikipedia.org/wiki/X.509'
},
{
value: 7400,
message: 'A popular series of digital logic integrated circuits.',
- guessed: false
+ guessed: false,
+ link: 'https://en.wikipedia.org/wiki/7400_series'
+ },
+ {
+ value: 65537,
+ message: 'The most commonly chosen exponent in the RSA cryptosystem.',
+ guessed: false,
+ link: 'https://en.wikipedia.org/wiki/65537#Applications'
+ },
+ {
+ value: 777,
+ message: 'The chmod octal permission mode for full access.',
+ guessed: false,
+ link: 'https://en.wikipedia.org/wiki/Chmod'
+ },
+ {
+ value: 8601,
+ message: 'The ISO standard for human-readable universal date and time representation.',
+ guessed: false,
+ link: 'https://en.wikipedia.org/wiki/ISO_8601'
},
- { value: 65537, message: 'The de facto exponent used in RSA encryption.', guessed: false },
- { value: 777, message: 'The chmod octal permission mode for full access.', guessed: false },
- { value: 8601, message: 'The ISO standard for date and time representation.', guessed: false },
{
value: 2600,
- message: '2600: The Hacker Quarterly, a popular technical magazine for hackers.',
- guessed: false
+ message:
+ '2600: The Hacker Quarterly, a popular technical magazine, referencing the 2600Hz phreaking tone.',
+ guessed: false,
+ link: 'https://en.wikipedia.org/wiki/2600:_The_Hacker_Quarterly'
+ },
+ {
+ value: 5994,
+ message: 'The field refresh frequency for NTSC color.',
+ guessed: false,
+ link: 'https://en.wikipedia.org/wiki/NTSC#Resolution_and_refresh_rate'
+ },
+ {
+ value: 437,
+ message: 'The original IBM PC code page.',
+ guessed: false,
+ link: 'https://en.wikipedia.org/wiki/Code_page_437'
},
- { value: 5994, message: 'The NTSC vertical scan rate.', guessed: false },
- { value: 437, message: 'The original IBM PC code page.', guessed: false },
{
value: 471768,
message:
'The truncated solution to the 25-year-long Busy Beaver Challenge for 5-state 2-symbol Turing machines.',
- guessed: false
+ guessed: false,
+ link: 'https://en.wikipedia.org/wiki/Busy_Beaver'
}
];