Public repository: timo / schach

Reader

Ein aufgeräumtes Schach-Programm für GNOME

feat(training): name the due line, hint follows it

public

feat(training): name the due line, hint follows it

Coach bar opens with "Heute dran: Linie 3 von 13 (neu) – <name>".
Hint showed the main line even when another line was due.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Changesetb7d17513a96354675c872cb40ec8c194f0f34018
Author (claimed)Timo Stolz <timo.stolz@nullachtvierzehn.de>,
Parents2ef09b306316
Childrenb987c60917a3
Pushlog
by timo via ssh
by timo via ssh

modified schach/training.py +17 −2

@@ -250,7 +250,8 @@ class OpeningMixin:
250250
         self.view.flipped = self.human == chess.BLACK
251251
         self.list_btn.set_active(False)
252252
         self.coach_log = []
253
-        self._coach(_escape(notation.text(course.welcome or course.intro, self._notation())))
253
+        welcome = _escape(notation.text(course.welcome or course.intro, self._notation()))
254
+        self._coach(f"{welcome}\n<b>{_escape(self._opening_line_text())}</b>")
254255
         self._changed()
255256
         self._refresh()
256257
         self._opening_next_step()
@@ -295,6 +296,19 @@ class OpeningMixin:
295296
 
296297
         self.maia.submit(maia_candidates(board, self.elo, count=8), pick)
297298
 
299
+    def _opening_line_text(self):
300
+        """„Heute dran: Linie 3 von 13 (neu) – Italienisch: Giuoco Pianissimo“."""
301
+        line_id, moves = self.course_line
302
+        all_ids = [i for i, _m in repetition.lines(self.course)]
303
+        end = self.course.start()
304
+        for move in moves:
305
+            end.push(move)
306
+        name = _names().name(end)
307
+        name = notation.text(name, self._notation()) if name else ""
308
+        kind = "neu" if progress().card(self.course, line_id) is None else "Wiederholung"
309
+        text = f"Heute dran: Linie {all_ids.index(line_id) + 1} von {len(all_ids)} ({kind})"
310
+        return f"{text} – {name}" if name and name != self.course.title else text
311
+
298312
     def _opening_target(self, options):
299313
         """Kursantwort entlang der heutigen Linie – solange die Partie noch auf ihr ist."""
300314
         if self.course_line is None:
@@ -393,7 +407,8 @@ class OpeningMixin:
393407
     def _opening_hint(self):
394408
         options = self.course.options(self.board) if self.course else []
395409
         if options:
396
-            self.hint_move = options[0].move
410
+            target = self._opening_target(options)  # Hinweis folgt der Linie von heute
411
+            self.hint_move = (target or options[0]).move
397412
             self.course_stats["hints"] += 1
398413
 
399414
     def _opening_finished(self):