fix(training): grade a hint up to the target square as again
draft training obsolete
fix(training): grade a hint up to the target square as again Second hint stage shows the whole move, so the answer was not recalled. Piece-only hint stays hard. Applies to course moves and puzzle reviews; puzzles count both stages like courses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| Changeset | 38b6077112d0ee4cf848d84bfb45977b184a39f0 |
|---|---|
| Author (claimed) | Timo Stolz <timo.stolz@nullachtvierzehn.de>, |
| Parents | 6922aeec5d45 |
| Children | 6767b4e6f8ee |
| Pushlog | by timo via ssh |
modified roadmap/training.md +3 −3
| @@ -130,8 +130,7 @@ wird gepflegt (6.3.3, letzter Commit 13. | ||
| 130 | 130 | | Ereignis | Fehlerpunkte | |
| 131 | 131 | | --- | --- | |
| 132 | 132 | | Hinweis Stufe 1 (Figur) | 0,5 | |
| 133 | -| Hinweis Stufe 2 (Zielfeld) | 1 | | |
| 134 | -| Hinweis Stufe 3, Analysebrett oder „Lösung zeigen“ | sofort Nochmal | | |
| 133 | +| Hinweis Stufe 2 (Zielfeld, also der ganze Zug), Analysebrett oder „Lösung zeigen“ | sofort Nochmal | | |
| 135 | 134 | | falscher Zug, kleiner Verlust | 1 | |
| 136 | 135 | | Patzer (? oder ??), bei B der Partiezug noch einmal | sofort Nochmal | |
| 137 | 136 | | nur bei B: guter, aber nicht der beste Zug | 0 | |
| @@ -174,7 +173,8 @@ Lichess gemeldet, sonst stimmt die Wertu | ||
| 174 | 173 | zuerst. Erst wenn keins fällig ist, kommt ein neues von Lichess. Wiederholungen gehen |
| 175 | 174 | ohne Netz; die Kopfzeile sagt „Wiederholung · Rätsel 900“. |
| 176 | 175 | - Bewertung wie überall: fehlerfrei Gut, ein falscher Zug Schwer (für FSRS ein Vergessen), |
| 177 | - mehr oder der Hinweis (er zeigt den Zug) Nochmal. Nochmal kommt heute erneut, aber nicht | |
| 176 | + der Hinweis bis zur Figur (Stufe 1) ebenfalls Schwer, mehr oder der Hinweis bis zum | |
| 177 | + Zielfeld (Stufe 2) Nochmal. Nochmal kommt heute erneut, aber nicht | |
| 178 | 178 | direkt hintereinander. Ein übersprungenes Rätsel bleibt fällig. |
| 179 | 179 | |
| 180 | 180 | ## Kurse: nicht jedes Mal von vorn |
modified schach/app.py +2 −0
| @@ -1089,6 +1089,8 @@ class Window(OnlineMixin, PuzzleMixin, O | ||
| 1089 | 1089 | self.hint_level = 2 |
| 1090 | 1090 | if self.mode == "opening": |
| 1091 | 1091 | self.course_stats["reveals"] += 1 # zweite Hälfte des Hinweises: auch das Zielfeld |
| 1092 | + elif self.mode == "puzzle": | |
| 1093 | + self._puzzle_reveal() | |
| 1092 | 1094 | self._refresh() |
| 1093 | 1095 | return |
| 1094 | 1096 | if self.hint_level >= 2: |
modified schach/puzzles.py +13 −5
| @@ -70,7 +70,7 @@ class PuzzleMixin: | ||
| 70 | 70 | "id": info["id"], "rating": info.get("rating"), "themes": info.get("themes", []), |
| 71 | 71 | "solution": solution, "index": 0, "failed": False, "done": False, |
| 72 | 72 | "reported": False, "rating_diff": None, |
| 73 | - "review": review, "errors": 0, "hints": 0, "recorded": False, "saved_days": None, | |
| 73 | + "review": review, "errors": 0, "hints": 0, "reveals": 0, "recorded": False, "saved_days": None, | |
| 74 | 74 | "fen": board.fen(), "last": last.uci(), "started": time.monotonic(), |
| 75 | 75 | } |
| 76 | 76 | self._changed() |
| @@ -138,6 +138,11 @@ class PuzzleMixin: | ||
| 138 | 138 | self._puzzle_fail() |
| 139 | 139 | self.hint_move = p["solution"][p["index"]] |
| 140 | 140 | |
| 141 | + def _puzzle_reveal(self): | |
| 142 | + """Zweite Stufe des Hinweises: auch das Zielfeld, also der ganze Zug.""" | |
| 143 | + if self.puzzle is not None: | |
| 144 | + self.puzzle["reveals"] += 1 | |
| 145 | + | |
| 141 | 146 | def _puzzle_fail(self): |
| 142 | 147 | p = self.puzzle |
| 143 | 148 | if not p["failed"]: |
| @@ -149,8 +154,9 @@ class PuzzleMixin: | ||
| 149 | 154 | p = self.puzzle |
| 150 | 155 | p["done"] = True |
| 151 | 156 | if p["review"]: |
| 152 | - # Hinweis zeigt den Zug, das ist „Lösung zeigen“ – sofort Nochmal | |
| 153 | - grade = repetition.AGAIN if p["hints"] else repetition.grade(p["errors"], 0, 0) | |
| 157 | + # Hinweis Stufe 1 (Figur) wie ein halber Fehler, Stufe 2 (ganzer Zug) sofort Nochmal | |
| 158 | + hints = repetition.hint_weight(p["hints"], p["reveals"]) | |
| 159 | + grade = repetition.grade(p["errors"], hints, 0, p["reveals"]) | |
| 154 | 160 | days = self._puzzle_record(grade) |
| 155 | 161 | lead = "Gelöst!" if grade == repetition.GOOD else "Geschafft." |
| 156 | 162 | if days is not None: |
| @@ -188,7 +194,8 @@ class PuzzleMixin: | ||
| 188 | 194 | info = {"id": p["id"], "fen": p["fen"], "last": p["last"], |
| 189 | 195 | "solution": [move.uci() for move in p["solution"]], |
| 190 | 196 | "rating": p["rating"], "themes": p["themes"]} |
| 191 | - p["saved_days"] = progress.save_puzzle(info, errors=p["errors"], hints=p["hints"]) | |
| 197 | + p["saved_days"] = progress.save_puzzle(info, errors=p["errors"], | |
| 198 | + hints=repetition.hint_weight(p["hints"], p["reveals"])) | |
| 192 | 199 | |
| 193 | 200 | def _puzzle_record(self, grade): |
| 194 | 201 | p = self.puzzle |
| @@ -198,7 +205,8 @@ class PuzzleMixin: | ||
| 198 | 205 | p["recorded"] = True |
| 199 | 206 | self.puzzle_recent = p["id"] |
| 200 | 207 | duration = int((time.monotonic() - p["started"]) * 1000) |
| 201 | - return progress.record_puzzle(p["id"], grade, errors=p["errors"], hints=p["hints"], | |
| 208 | + hints = repetition.hint_weight(p["hints"], p["reveals"]) | |
| 209 | + return progress.record_puzzle(p["id"], grade, errors=p["errors"], hints=hints, | |
| 202 | 210 | duration_ms=duration) |
| 203 | 211 | |
| 204 | 212 | def _puzzle_report(self, win): |
modified schach/repetition.py +3 −2
| @@ -487,12 +487,13 @@ def hint_weight(hints, reveals): | ||
| 487 | 487 | return (hints + reveals) / 2 |
| 488 | 488 | |
| 489 | 489 | |
| 490 | -def grade(errors, hints, blunders): | |
| 490 | +def grade(errors, hints, blunders, reveals=0): | |
| 491 | 491 | """Stufe wie bei Anki, aus dem Verlauf: kein Ausrutscher gut, einer schwer, mehr (oder ein Patzer) nochmal. |
| 492 | 492 | |
| 493 | 493 | ``hints`` darf halbe Hinweise enthalten (siehe ``hint_weight``): Hilfe gebraucht ist nie „gut“. |
| 494 | + ``reveals``: Hinweise bis Stufe 2 (Figur und Zielfeld, also der ganze Zug) – das ist Nochmal. | |
| 494 | 495 | """ |
| 495 | - if blunders or errors + hints > 1: | |
| 496 | + if blunders or reveals or errors + hints > 1: | |
| 496 | 497 | return AGAIN |
| 497 | 498 | if errors + hints > 0: |
| 498 | 499 | return HARD |
modified schach/training.py +1 −1
| @@ -993,7 +993,7 @@ class OpeningMixin: | ||
| 993 | 993 | base, self.decision = self.decision, None |
| 994 | 994 | delta = {k: self.course_stats[k] - base[k] for k in ("errors", "hints", "reveals", "blunders")} |
| 995 | 995 | hints = repetition.hint_weight(delta["hints"], delta["reveals"]) |
| 996 | - level = repetition.grade(delta["errors"], hints, delta["blunders"]) | |
| 996 | + level = repetition.grade(delta["errors"], hints, delta["blunders"], delta["reveals"]) | |
| 997 | 997 | days = progress().record(self.course, before, level, errors=delta["errors"], hints=hints, |
| 998 | 998 | blunders=delta["blunders"]) |
| 999 | 999 | self.course_records.append((level, days)) |
modified tests/test_puzzle_cards.py +18 −0
| @@ -137,6 +137,24 @@ class PuzzleCardTest(unittest.TestCase): | ||
| 137 | 137 | window.start_puzzle() |
| 138 | 138 | self.background.assert_called_once() # … aber erst nach einem neuen von Lichess |
| 139 | 139 | |
| 140 | + def _review_with_hint(self, reveal): | |
| 141 | + self.progress.save_puzzle(PUZZLE, now=datetime.datetime.now() - datetime.timedelta(days=3)) | |
| 142 | + window = FakeWindow() | |
| 143 | + window.start_puzzle() | |
| 144 | + window._puzzle_hint() # Stufe 1: die Figur | |
| 145 | + if reveal: | |
| 146 | + window._puzzle_reveal() # Stufe 2: auch das Zielfeld | |
| 147 | + window._puzzle_play(chess.Move.from_uci("h5f7")) | |
| 148 | + return window.final_text | |
| 149 | + | |
| 150 | + def test_hint_showing_the_piece_is_hard(self): | |
| 151 | + self.assertIn("Fast. Dieses Rätsel kommt", self._review_with_hint(reveal=False)) | |
| 152 | + self.assertEqual(self.progress.puzzles_due(), 0) # nicht heute noch einmal | |
| 153 | + | |
| 154 | + def test_hint_showing_the_move_is_again(self): | |
| 155 | + self.assertIn("Das Rätsel wiederholen wir gleich", self._review_with_hint(reveal=True)) | |
| 156 | + self.assertEqual(self.progress.puzzles_due(), 1) | |
| 157 | + | |
| 140 | 158 | |
| 141 | 159 | class DuePuzzleTest(unittest.TestCase): |
| 142 | 160 | def test_most_overdue_first(self): |
modified tests/test_repetition.py +1 −1
| @@ -167,7 +167,7 @@ class ProgressTest(unittest.TestCase): | ||
| 167 | 167 | self.assertEqual(repetition.grade(0, half, 0), H) # Hilfe gebraucht ist nie „gut“ |
| 168 | 168 | self.assertEqual(repetition.grade(0, repetition.hint_weight(2, 0), 0), H) |
| 169 | 169 | self.assertEqual(repetition.grade(1, half, 0), A) |
| 170 | - self.assertEqual(repetition.grade(0, repetition.hint_weight(1, 1), 0), H) | |
| 170 | + self.assertEqual(repetition.grade(0, repetition.hint_weight(1, 1), 0, reveals=1), A) # ganzer Zug | |
| 171 | 171 | self.assertEqual(repetition.grade(0, repetition.hint_weight(2, 1), 0), A) |
| 172 | 172 | |
| 173 | 173 | def test_hard_is_not_repeated_today(self): |