app/led_assist.h¶
policy layer that turns game events into LED highlights.
LedAssist is a GameSessionListener: it translates last-move / check / error events into per-square (color, category) highlights and pushes them to a LedController, honoring a per-user “how much help” config. It knows chess; LedController knows the wire. Legal-move highlighting (the piece-lift path and the shared 16-square budget arbitration) arrives in L3 — this L2 layer covers the passive highlights that come free from state already in hand.
Fully off-Pi testable: drive it with MoveEvents/FENs and inspect the LedController (SimLedDriver). See docs/led-docs/PLAN.md §7, §9.
-
namespace kirin
Enums
-
class IHintSource¶
- #include <led_assist.h>
Subclassed by kirin::EngineHintSource
-
class ILegalMoveSource¶
- #include <led_assist.h>
Subclassed by kirin::EngineLegalMoveSource
Public Functions
-
virtual ~ILegalMoveSource() = default¶
-
virtual std::vector<LegalTarget> legalTargetsFrom(int square) = 0¶
-
inline virtual int bestTargetFrom(int square)¶
-
virtual ~ILegalMoveSource() = default¶
-
class LedAssist : public kirin::GameSessionListener¶
- #include <led_assist.h>
Public Functions
-
explicit LedAssist(LedController &leds, const LedAssistConfig &config = {})¶
-
void setConfig(const LedAssistConfig &config)¶
-
inline void setPreset(AssistPreset preset)¶
-
inline const LedAssistConfig &config() const¶
-
inline void setMoveSource(ILegalMoveSource *source)¶
-
inline void setHintSource(IHintSource *source)¶
-
inline void setRenderListener(std::function<void()> onRendered)¶
-
virtual void onStateChanged(SessionState state) override¶
-
virtual void onHumanTurn(char sideToMove) override¶
-
virtual void onGameOver(const GameOverInfo &info) override¶
-
virtual void onBoardMismatch(const BoardMismatchInfo &info) override¶
-
void onPieceLifted(int square)¶
-
void onBoardSettled()¶
-
ScannerObserver scannerObserver()¶
Private Members
-
std::mutex mtx_¶
-
LedController &leds_¶
-
LedAssistConfig cfg_¶
-
ILegalMoveSource *moves_ = nullptr¶
-
IHintSource *hints_ = nullptr¶
-
std::function<void()> onRendered_¶
-
int lastFrom_ = -1¶
-
int lastTo_ = -1¶
-
int checkSquare_ = -1¶
-
int liftedSquare_ = -1¶
-
int recFrom_ = -1¶
-
int recTo_ = -1¶
-
bool errorActive_ = false¶
-
std::vector<int> errorSquares_¶
-
explicit LedAssist(LedController &leds, const LedAssistConfig &config = {})¶
-
struct LedAssistConfig¶
- #include <led_assist.h>
-
struct LegalTarget¶
- #include <led_assist.h>
-
class IHintSource¶