From 45e0da6ada76f331a33d53dc4af02058f039ba3d Mon Sep 17 00:00:00 2001 From: Dmitry Bikulov Date: Tue, 16 Sep 2025 00:28:52 +0300 Subject: [PATCH] Update math --- .gitignore | 3 ++- app/main.py | 10 +++------- static/style.css | 2 +- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 8bdaf38..d81e965 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.pyc -static/.DS_Store +*.zip +.DS_Store diff --git a/app/main.py b/app/main.py index f50e088..0e47195 100644 --- a/app/main.py +++ b/app/main.py @@ -78,17 +78,13 @@ class Session: @staticmethod def _generate_questions(n: int) -> List[Dict]: # Build unique unordered pairs (avoid mirrored duplicates like 6×8 and 8×6) - all_pairs = [(a, b) for a in range(2, 6) for b in range(a, 6)] # a <= b + all_pairs = [(a, b) for a in range(2, 10) for b in range(2, 10)] # a <= b count = min(n, len(all_pairs)) + print(count) picked = random.sample(all_pairs, count) questions: List[Dict] = [] - for a0, b0 in picked: - # Randomize order for variety while keeping uniqueness by unordered pair - if random.random() < 0.5: - a, b = a0, b0 - else: - a, b = b0, a0 + for a, b in picked: correct = a * b options = Session._generate_options(a, b, correct) questions.append({ diff --git a/static/style.css b/static/style.css index dd2033d..8eb862b 100644 --- a/static/style.css +++ b/static/style.css @@ -71,7 +71,7 @@ body { .result { margin-top: 18px; padding: 18px; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); } .result .score { font-size: 20px; margin-bottom: 8px; } -.again { padding: 10px 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel); color: #0f172a; cursor: pointer; box-shadow: var(--shadow); } +.again { margin-top: 1em; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel); color: #0f172a; cursor: pointer; box-shadow: var(--shadow); } .again:hover { background: #f1f5f9; } .hidden { display: none; }