From 159f4197ae5486ea6b318445fc15a282135fd924 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=90=D0=BD=D1=82=D0=BE=D0=BD=20=D0=A2=D1=80=D0=BE=D1=88?=
=?UTF-8?q?=D0=B8=D0=BD?=
Date: Fri, 17 Jul 2026 23:44:44 +0300
Subject: [PATCH] theory pages added
---
app.js | 69 +++++++++++++++++++++++++++++++++++++++++
index.html | 32 +++++++++++++++++--
styles.css | 66 +++++++++++++++++++++++++++++++++++++++
sw.js | 3 +-
theory/base3.en.html | 8 +++++
theory/base3.ru.html | 8 +++++
theory/binary.en.html | 9 ++++++
theory/binary.ru.html | 9 ++++++
theory/braille.en.html | 9 ++++++
theory/braille.ru.html | 9 ++++++
theory/greek.en.html | 15 +++++++++
theory/greek.ru.html | 15 +++++++++
theory/hebrew.en.html | 22 +++++++++++++
theory/hebrew.ru.html | 22 +++++++++++++
theory/hex.en.html | 8 +++++
theory/hex.ru.html | 8 +++++
theory/octal.en.html | 8 +++++
theory/octal.ru.html | 8 +++++
theory/roman.en.html | 11 +++++++
theory/roman.ru.html | 11 +++++++
theory/slavonic.en.html | 15 +++++++++
theory/slavonic.ru.html | 15 +++++++++
theory/ternary.en.html | 11 +++++++
theory/ternary.ru.html | 11 +++++++
24 files changed, 398 insertions(+), 4 deletions(-)
create mode 100644 theory/base3.en.html
create mode 100644 theory/base3.ru.html
create mode 100644 theory/binary.en.html
create mode 100644 theory/binary.ru.html
create mode 100644 theory/braille.en.html
create mode 100644 theory/braille.ru.html
create mode 100644 theory/greek.en.html
create mode 100644 theory/greek.ru.html
create mode 100644 theory/hebrew.en.html
create mode 100644 theory/hebrew.ru.html
create mode 100644 theory/hex.en.html
create mode 100644 theory/hex.ru.html
create mode 100644 theory/octal.en.html
create mode 100644 theory/octal.ru.html
create mode 100644 theory/roman.en.html
create mode 100644 theory/roman.ru.html
create mode 100644 theory/slavonic.en.html
create mode 100644 theory/slavonic.ru.html
create mode 100644 theory/ternary.en.html
create mode 100644 theory/ternary.ru.html
diff --git a/app.js b/app.js
index 0629f6e..1e10c0e 100644
--- a/app.js
+++ b/app.js
@@ -6,6 +6,7 @@ const STRINGS = {
en: {
subtitle: 'Numeral systems trainer',
startGame: 'Start',
+ theory: 'Theory',
chooseSystem: 'Choose numeral system',
positional: 'Positional',
nonPositional: 'Non-Positional',
@@ -46,6 +47,7 @@ const STRINGS = {
ru: {
subtitle: '\u0422\u0440\u0435\u043D\u0430\u0436\u0435\u0440 \u0441\u0438\u0441\u0442\u0435\u043C \u0441\u0447\u0438\u0441\u043B\u0435\u043D\u0438\u044F',
startGame: 'Начать',
+ theory: '\u0422\u0435\u043E\u0440\u0438\u044F',
chooseSystem: '\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0441\u0438\u0441\u0442\u0435\u043C\u0443 \u0441\u0447\u0438\u0441\u043B\u0435\u043D\u0438\u044F',
positional: '\u041F\u043E\u0437\u0438\u0446\u0438\u043E\u043D\u043D\u044B\u0435',
nonPositional: '\u041D\u0435\u043F\u043E\u0437\u0438\u0446\u0438\u043E\u043D\u043D\u044B\u0435',
@@ -185,6 +187,8 @@ const SYSTEM_GROUPS = {
nonpos: ['roman', 'greek', 'slavonic', 'hebrew'],
};
+const theoryCache = {};
+
const MODES = [
{ labelKey: 'choose', value: 'choice' },
{ labelKey: 'type', value: 'manual' },
@@ -700,6 +704,59 @@ function spawnConfetti() {
}
}
+// ---- THEORY ----
+
+async function loadTheory(key) {
+ if (theoryCache[key]) return theoryCache[key];
+ try {
+ const resp = await fetch(`theory/${key}.${LANG}.html`);
+ if (!resp.ok) throw new Error(resp.status);
+ const html = await resp.text();
+ theoryCache[key] = html;
+ return html;
+ } catch {
+ if (LANG !== 'en') {
+ try {
+ const resp = await fetch(`theory/${key}.en.html`);
+ const html = await resp.text();
+ theoryCache[key] = html;
+ return html;
+ } catch { return null; }
+ }
+ return null;
+ }
+}
+
+function renderTheorySystem() {
+ const posDiv = document.getElementById('theory-systems-pos');
+ const nonposDiv = document.getElementById('theory-systems-nonpos');
+ posDiv.innerHTML = '';
+ nonposDiv.innerHTML = '';
+
+ for (const [group, keys] of Object.entries(SYSTEM_GROUPS)) {
+ const target = group === 'pos' ? posDiv : nonposDiv;
+ keys.forEach(key => {
+ const btn = document.createElement('button');
+ btn.className = 'option-btn';
+ btn.textContent = systemName(key);
+ btn.addEventListener('click', () => showTheoryContent(key));
+ target.appendChild(btn);
+ });
+ }
+
+ showScreen('theory-system');
+}
+
+async function showTheoryContent(key) {
+ const html = await loadTheory(key);
+ if (!html) return;
+
+ document.getElementById('theory-title').textContent = systemName(key);
+ document.getElementById('theory-scroll').innerHTML = html;
+
+ showScreen('theory-content');
+}
+
// ---- INIT ----
const SUBSCRIPTS = { '0':'\u2080', '1':'\u2081', '2':'\u2082', '3':'\u2083',
@@ -875,6 +932,18 @@ document.getElementById('btn-results-menu').addEventListener('click', () => {
showScreen('menu');
});
+document.getElementById('btn-theory').addEventListener('click', () => {
+ renderTheorySystem();
+});
+
+document.getElementById('btn-theory-back').addEventListener('click', () => {
+ showScreen('menu');
+});
+
+document.getElementById('btn-theory-content-back').addEventListener('click', () => {
+ renderTheorySystem();
+});
+
document.getElementById('btn-stop').addEventListener('click', () => {
stopTimer();
endGame();
diff --git a/index.html b/index.html
index 1adfce8..777268a 100644
--- a/index.html
+++ b/index.html
@@ -10,7 +10,7 @@
-
+
Choose numeral system
+ Non-Positional
+
+ Positional
+
+ Base: 3
+
The ternary (base-3) numeral system uses three digits: 0, 1, and 2. Each position represents a power of 3.
+Ternary systems are used in some specialized computing applications (ternary logic). Some argue that base-3 is the most efficient integer base for computation, as it is the closest to the mathematical constant e ≈ 2.718.
\ No newline at end of file diff --git a/theory/base3.ru.html b/theory/base3.ru.html new file mode 100644 index 0000000..a531d55 --- /dev/null +++ b/theory/base3.ru.html @@ -0,0 +1,8 @@ +Троичная (троичная) система счисления использует три цифры: 0, 1 и 2. Каждая позиция представляет степень тройки.
+Троичная система используется в некоторых специализированных вычислениях (троичная логика). Некоторые считают, что троичная система является наиболее эффективной для вычислений, поскольку близка к математической константе e ≈ 2,718.
\ No newline at end of file diff --git a/theory/binary.en.html b/theory/binary.en.html new file mode 100644 index 0000000..67cf4da --- /dev/null +++ b/theory/binary.en.html @@ -0,0 +1,9 @@ +The binary (base-2) numeral system uses only two digits: 0 and 1. It is the fundamental language of digital computers, where each digit represents a single bit — an electrical signal that is either off (0) or on (1).
+Each position represents a power of 2, increasing from right to left:
+Binary is used internally by all modern computers. File storage, memory addresses, and network protocols all rely on binary representation at the lowest level.
\ No newline at end of file diff --git a/theory/binary.ru.html b/theory/binary.ru.html new file mode 100644 index 0000000..2ae6807 --- /dev/null +++ b/theory/binary.ru.html @@ -0,0 +1,9 @@ +Двоичная (двоичная) система счисления использует только две цифры: 0 и 1. Это основной язык цифровых компьютеров, где каждый бит представляет электрический сигнал — выключен (0) или включен (1).
+Каждая позиция представляет степень двойки, увеличиваясь справа налево:
+Двоичная система используется внутри всеми современными компьютерами. Хранение файлов, адреса памяти и сетевые протоколы работают на двоичном представлении на нижнем уровне.
\ No newline at end of file diff --git a/theory/braille.en.html b/theory/braille.en.html new file mode 100644 index 0000000..c6276bf --- /dev/null +++ b/theory/braille.en.html @@ -0,0 +1,9 @@ +Braille is a tactile writing system used by people who are visually impaired. Each digit is represented by a specific pattern of raised dots within a 2×3 cell. In this app, the Braille decimal system encodes digits 0–9.
+Each digit is preceded by the number indicator (⠼), which signals that the following characters represent numbers rather than letters.
+These correspond to: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
+Braille numerals are used in Braille books, signage, and electronic Braille displays. The number sign distinguishes numeric content from alphabetic text.
\ No newline at end of file diff --git a/theory/braille.ru.html b/theory/braille.ru.html new file mode 100644 index 0000000..8fb93eb --- /dev/null +++ b/theory/braille.ru.html @@ -0,0 +1,9 @@ +Шрифт Брайля — это тактильная система письма, используемая людьми с нарушениями зрения. Каждая цифра представлена специальным паттерном выпуклых точек в ячейке 2×3.
+Каждая цифра предварена индикатором номера (⠼), который сигнализирует, что следующие символы являются числами.
+Соответствуют: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
+Шрифтовые числа используются в книгах для незрядых, на досках и электронных брайловых дисплеях.
\ No newline at end of file diff --git a/theory/greek.en.html b/theory/greek.en.html new file mode 100644 index 0000000..6bc9100 --- /dev/null +++ b/theory/greek.en.html @@ -0,0 +1,15 @@ +Greek numerals are a decimal system that uses letters of the Greek alphabet to represent numbers. Known as Ionian or alphabetic numerals, this system was adopted around the 4th century BC.
+Letters are assigned values from 1 to 9 (units), 10 to 90 (tens), and 100 to 900 (hundreds). A special mark (´, keraia) is placed after the number. Thousands are indicated by a subscript mark (͵) before the units letter.
+(α=1, β=2, γ=3, δ=4, ε=5, ϛ=6, ζ=7, η=8, θ=9)
+(ι=10, κ=20, λ=30, μ=40, ν=50, ξ=60, ο=70, π=80, ϟ=90)
+(ρ=100, σ=200, τ=300, υ=400, φ=500, χ=600, ψ=700, ω=800, ϡ=900)
+Греческие числа — десятичная система, использующая буквы греческого алфавита для обозначения чисел. Известна как ионическая или алфавитная система, была принята около IV века до н.э.
+Буквам присваиваются значения от 1 до 9 (единицы), 10 до 90 (десятки) и 100 до 900 (сотни). Число завершается символом кераия (´). Тысячи обозначаются индиксом (͵) перед буквой единиц.
+(α=1, β=2, γ=3, δ=4, ε=5, ϛ=6, ζ=7, η=8, θ=9)
+(ι=10, κ=20, λ=30, μ=40, ν=50, ξ=60, ο=70, π=80, ϟ=90)
+(ρ=100, σ=200, τ=300, υ=400, φ=500, χ=600, ψ=700, ω=800, ϡ=900)
+Hebrew numerals are an alphanumeric system where letters of the Hebrew alphabet are assigned numerical values. Known as "gematria," this system has been used for centuries in Jewish tradition.
+Letters represent values from 1–9 (units), 10–90 (tens), and 100–400 (hundreds). Numbers are written by combining letters, with the larger values first. A single apostrophe (geresh, ׳) follows single-letter numbers, and a double apostrophe (gershayim, ״) is placed before the last letter of multi-letter numbers.
+15 and 16 use טו and טז instead of יה and יו to avoid writing God's name.
+(א=1, ב=2, ג=3, ד=4, ה=5, ו=6, ז=7, ח=8, ט=9)
+(י=10, כ=20, ל=30, מ=40, נ=50, ס=60, ע=70, פ=80, צ=90)
+(ק=100, ר=200, ש=300, ת=400)
+Numbers above 400 are written additively by combining tav (400) with hundreds:
+Thousands are written as the units letter followed by geresh:
+Еврейские числа — алфавитная система, в которой буквам алфавита присваиваются числовые значения. Известна как гематрия, эта система используется в еврейской традиции веками.
+Буквы представляют значения 1–9 (единицы), 10–90 (десятки) и 100–400 (сотни). Числа пишутся комбинацией букв, по правилу от больших к меньшим. Однобуквенные числа завершаются герешем (׳), многобуквенные — гершайми (״) перед последней буквой.
+15 и 16 пишутся как טו и טז вместо יה и יו, чтобы не писать имя Божье.
+(א=1, ב=2, ג=3, ד=4, ה=5, ו=6, ז=7, ח=8, ט=9)
+(י=10, כ=20, ל=30, מ=40, נ=50, ס=60, ע=70, פ=80, צ=90)
+(ק=100, ר=200, ש=300, ת=400)
+Числа более 400 записываются аддитивно сочетанием ת (400) с сотными:
+Тысячи обозначаются буквой единиц с герешом:
+The hexadecimal (base-16) numeral system uses sixteen symbols: the digits 0–9 and the letters A–F (representing values 10–15).
+Hexadecimal is ubiquitous in computing. Memory addresses, color codes in CSS (#E94560), MAC addresses, and file hashes all use hex because each hex digit maps to exactly four binary digits, making it a compact and human-readable representation of binary data.
\ No newline at end of file diff --git a/theory/hex.ru.html b/theory/hex.ru.html new file mode 100644 index 0000000..71a0bf7 --- /dev/null +++ b/theory/hex.ru.html @@ -0,0 +1,8 @@ +Шестнадцатеричная (шестнадцатеричная) система счисления использует шестнадцать символов: цифры 0–9 и буквы A–F (значения 10–15).
+Шестнадцатеричная система повсеместно используется в компьютерной технике. Адреса памяти, цветовые коды в CSS (#E94560), MAC-адреса и хеши файлов используют шестнадцатерную, поскольку каждая шестнадцатерная цифра соответствует четырем двоичным.
\ No newline at end of file diff --git a/theory/octal.en.html b/theory/octal.en.html new file mode 100644 index 0000000..18654a1 --- /dev/null +++ b/theory/octal.en.html @@ -0,0 +1,8 @@ +The octal (base-8) numeral system uses eight digits: 0 through 7. Each position represents a power of 8.
+Octal was widely used in early computing (e.g. PDP-8, IBM mainframes) because it provides a compact way to represent binary numbers: each octal digit maps to exactly three binary digits. Today it appears in Unix file permissions (chmod 755) and some legacy systems.
\ No newline at end of file diff --git a/theory/octal.ru.html b/theory/octal.ru.html new file mode 100644 index 0000000..ca17ef9 --- /dev/null +++ b/theory/octal.ru.html @@ -0,0 +1,8 @@ +Восьмеричная (восьмеричная) система счисления использует восемь цифр: 0–7. Каждая позиция представляет степень восьми.
+Восьмеричная система была широко применена в раннем программировании (например PDP-8, главные ЭВМ IBM), потому что каждая восьмеричная цифра соответствует трем двоичным. Сейчас встречается в правах доступа Unix (chmod 755) и некоторых устаревших системах.
\ No newline at end of file diff --git a/theory/roman.en.html b/theory/roman.en.html new file mode 100644 index 0000000..136c14a --- /dev/null +++ b/theory/roman.en.html @@ -0,0 +1,11 @@ +Roman numerals originated in ancient Rome and remained the standard way of writing numbers throughout Europe well into the Middle Ages. They use combinations of letters from the Latin alphabet.
+Roman numerals are primarily additive: values are summed left to right. However, a smaller value placed before a larger one indicates subtraction:
+Roman numerals can represent numbers from 1 to 3999. I, X, C, and M can be repeated up to three times. V, L, and D are never repeated. The subtractive combinations IV, IX, XL, XC, CM, and CD are the only allowed subtractions.
\ No newline at end of file diff --git a/theory/roman.ru.html b/theory/roman.ru.html new file mode 100644 index 0000000..67c8800 --- /dev/null +++ b/theory/roman.ru.html @@ -0,0 +1,11 @@ +Римские числа возникли в древнем Риме и оставались стандартным способом записи чисел в Европе до Средневековья. Они используют буквы латинского алфавита.
+Римские числа преимущественно аддитивны: значения складываются слева направо. Однако меньшая цифра перед большей означает вычитание:
+Римские числа могут представлять числа от 1 до 3999. I, X, C и M могут повторяться до трех раз. V, L и D никогда не повторяются.
\ No newline at end of file diff --git a/theory/slavonic.en.html b/theory/slavonic.en.html new file mode 100644 index 0000000..aa2af10 --- /dev/null +++ b/theory/slavonic.en.html @@ -0,0 +1,15 @@ +Church Slavonic numerals are a Cyrillic alphanumeric system used historically in Russian and other Slavic Orthodox cultures. Letters of the early Cyrillic alphabet are assigned numerical values.
+Like Greek numerals, Church Slavonic uses separate letter groups for units (1–9), tens (10–90), and hundreds (100–900). A titlo mark ( ҃) is placed above one of the letters to indicate it is a number. Thousands are marked with a special symbol (҂) placed before the number. The number ends with a period.
+(а=1, в=2, г=3, д=4, є=5, ѕ=6, з=7, и=8, ѳ=9)
+(і=10, к=20, л=30, м=40, н=50, ѯ=60, ѻ=70, п=80, ч=90)
+(р=100, с=200, т=300, у=400, ф=500, х=600, ѱ=700, Ѿ=800, ц=900)
+Церковнославянские числа — кириллическая цифровая система, использовавшаяся в русской и других славянских православных культурах. Буквы древней кириллической азбуки имеют числовые значения.
+Как и греческие, используются отдельные группы букв для единиц (1–9), десятков (10–90) и сотен (100–900). Над буквой ставится титло ( ҃). Тысячи обозначаются специальным знаком (҂). Число завершается точкой.
+(а=1, в=2, г=3, д=4, є=5, ѕ=6, з=7, и=8, ѳ=9)
+(і=10, к=20, л=30, м=40, н=50, ѯ=60, ѻ=70, п=80, ч=90)
+(р=100, с=200, т=300, у=400, ф=500, х=600, ѱ=700, Ѿ=800, ц=900)
+Balanced ternary is a non-standard positional system where each digit can be −1, 0, or +1. Instead of using the digits 0, 1, 2 as in standard ternary, it uses special symbols:
+⊖ (U+2296, Circled Minus) represents −1, and ⊕ (U+2295, Circled Plus) represents +1.
+Each position represents a power of 3, but digits can be negative:
+For negative numbers, the signs of all non-zero digits are flipped (⊕ ↔ ⊖).
+Balanced ternary has the unique property that the sign of a number can be determined from its most significant non-zero digit, eliminating the need for a separate sign. The system was studied by Leonardo Pisano (Fibonacci, 1170–1250) in connection with the weight problem — using weights of powers of 3, any integer mass from 1 can be measured with the fewest weights. In 1958, the Soviet engineer Nikolai Brusentsov built the Setun computer at Moscow State University, which used balanced ternary arithmetic and became one of the most elegant early ternary computers.
\ No newline at end of file diff --git a/theory/ternary.ru.html b/theory/ternary.ru.html new file mode 100644 index 0000000..d02ebb1 --- /dev/null +++ b/theory/ternary.ru.html @@ -0,0 +1,11 @@ +Уравновешенная троичная — это нестандартная позиционная система, где каждая цифра может быть равна −1, 0 или +1. Вместо цифр 0, 1, 2 используются специальные символы:
+⊖ (U+2296, Кружок с минусом) обозначает −1, а ⊕ (U+2295, Кружок с плюсом) — +1.
+Каждая позиция представляет степень тройки, но цифры могут быть отрицательными:
+Для отрицательных чисел все ненулевые цифры инвертируются (⊕ ↔ ⊖).
+У уравновешенной троичной знак числа определяется по первой ненулевой цифре старшего разряда, что устраняет необходимость отдельного знака знака. Эту систему изучал Леонардо Писано (Fibonacci, 1170–1250) в связи с задачей о взвешивании: используя гиря степени тройки, любую целую массу можно отвесить минимальным числом гиря. В 1958 году советский инженер Николай Брусенцов собрал в Мгу троичный компьютер Setun, который использовал уравновешенно-троичную арифметику и стал одним из самых элегантных ранних троичных компьютеров.
\ No newline at end of file