app.engine.all_engine_strategies module

Strategy enumeration backed by the explicit registry.

The legacy implementation walked app/engine with os.listdir() (CWD-dependent), imported every module, picked classes by “first letter uppercase”, and mutated the list while iterating. It also could not load strategies from external packages.

This module now:

  1. Auto-discovers every module inside the app.engine package using pkgutil.iter_modules() against the package’s resolved __path__ (independent of the current working directory), so newly added strategy files are picked up without editing this file.

  2. Imports each module, which triggers @register_strategy and registers the class in app.engine.strategy_registry. Modules that don’t register anything (helpers, base classes) simply contribute nothing.

  3. Returns instances of every class currently in the registry. Third-party strategies declared via the game.strategies entry point are loaded lazily by the registry.

app.engine.all_engine_strategies.all_engine_strategies()[source]

Return instances of every registered, validated strategy class.

Each instance has an id attribute set to the registered strategy id (the public identifier persisted on games and exposed by the API).

Returns:

List of strategy instances, one per registered class. Classes that fail check_class_methods_and_variables() are skipped.

Return type:

list