src.modules.backend.solver

Solver strategies subpackage. This package contains the solver strategy implementations for the Wordle solver.

class src.modules.backend.solver.StatelessSolverStrategy[source]

Abstract base class for stateless Wordle solver strategies.

abstractmethod get_top_suggestions(constraints, count=10, word_manager=None, stateless_word_manager=None, prefer_common=True, word_set=None)[source]

Get top N suggestions based on the strategy’s algorithm using stateless filtering.

Parameters:
  • constraints (List[Tuple[str, str]]) – List of (guess, result) tuples representing game constraints

  • count (int) – Number of suggestions to return

  • word_manager (Optional[WordManager]) – Optional WordManager instance for backward compatibility

  • stateless_word_manager (Optional[StatelessWordManager]) – Optional StatelessWordManager for pure stateless operations

  • prefer_common (bool) – Whether to prefer common words in suggestions

  • word_set (Optional[Set[str]]) – Optional specific set of words to consider. If None, uses all words.

Return type:

List[str]

Returns:

List of suggested words, ordered by preference

class src.modules.backend.solver.StatelessFrequencyStrategy[source]

Stateless strategy that uses actual word frequency data from corpus to suggest words.

get_top_suggestions(constraints, count=10, word_manager=None, stateless_word_manager=None, prefer_common=True, word_set=None)[source]

Get top N suggestions based on actual word frequency from corpus using stateless filtering.

Return type:

List[str]

class src.modules.backend.solver.StatelessEntropyStrategy[source]

Stateless strategy that uses information theory to maximize information gain.

get_top_suggestions(constraints, count=10, word_manager=None, stateless_word_manager=None, prefer_common=True, word_set=None)[source]

Get top N suggestions based on entropy (information gain) using stateless filtering.

Return type:

List[str]

class src.modules.backend.solver.StatelessHybridStrategy(frequency_weight=0.4, entropy_weight=0.6)[source]

Stateless strategy that combines frequency-based scoring with entropy for optimal word suggestions.

__init__(frequency_weight=0.4, entropy_weight=0.6)[source]

Initialize the hybrid strategy with customizable weights.

Parameters:
  • frequency_weight (float) – Weight for word frequency (0-1)

  • entropy_weight (float) – Weight for entropy (0-1)

get_top_suggestions(constraints, count=10, word_manager=None, stateless_word_manager=None, prefer_common=True, word_set=None)[source]

Get top N suggestions based on hybrid frequency-entropy scoring using stateless filtering.

Return type:

List[str]

class src.modules.backend.solver.StatelessMinimaxStrategy[source]

Stateless strategy that uses minimax algorithm to minimize worst-case remaining words.

get_top_suggestions(constraints, count=10, word_manager=None, stateless_word_manager=None, prefer_common=True, word_set=None)[source]

Get top N suggestions based on minimax strategy using stateless filtering.

Return type:

List[str]

class src.modules.backend.solver.StatelessTwoStepStrategy(max_patterns_to_evaluate=20)[source]

Stateless strategy that looks ahead two steps to choose optimal guesses.

__init__(max_patterns_to_evaluate=20)[source]

Initialize the two-step strategy.

Parameters:

max_patterns_to_evaluate (int) – Maximum number of patterns to evaluate for performance

get_top_suggestions(constraints, count=10, word_manager=None, stateless_word_manager=None, prefer_common=True, word_set=None)[source]

Get top N suggestions based on two-step lookahead using stateless filtering.

Return type:

List[str]

class src.modules.backend.solver.StatelessWeightedGainStrategy(entropy_weight=0.5, positional_weight=0.3, frequency_weight=0.2)[source]

Stateless strategy that combines multiple information metrics for better word suggestions.

This strategy uses a weighted combination of: - Shannon entropy (information gain) - Positional information (value of exact position matches) - Word frequency (likelihood of being the answer)

__init__(entropy_weight=0.5, positional_weight=0.3, frequency_weight=0.2)[source]

Initialize the weighted information gain strategy with customizable weights.

Parameters:
  • entropy_weight (float) – Weight for Shannon entropy (0-1)

  • positional_weight (float) – Weight for positional information (0-1)

  • frequency_weight (float) – Weight for word frequency information (0-1)

get_top_suggestions(constraints, count=10, word_manager=None, stateless_word_manager=None, prefer_common=True, word_set=None)[source]

Get top N suggestions based on weighted information gain using stateless filtering.

Return type:

List[str]

class src.modules.backend.solver.ModernizedStrategyFactory[source]

Modernized factory for creating stateless solver strategies only.

classmethod create_strategy(strategy_name, **kwargs)[source]

Create a stateless strategy instance.

Parameters:
  • strategy_name (str) – Name of the strategy to create

  • **kwargs – Additional arguments for strategy initialization

Return type:

StatelessSolverStrategy

Returns:

StatelessSolverStrategy instance

Raises:

ValueError – If strategy name is not found

classmethod get_available_strategies()[source]

Get information about available strategies.

Return type:

Dict[str, str]

classmethod register_strategy(name, strategy_class)[source]

Register a new strategy class.

Return type:

None

src.modules.backend.solver.SolverStrategy

alias of StatelessSolverStrategy

src.modules.backend.solver.FrequencyStrategy

alias of StatelessFrequencyStrategy

src.modules.backend.solver.EntropyStrategy

alias of StatelessEntropyStrategy

src.modules.backend.solver.HybridFrequencyEntropyStrategy

alias of StatelessHybridStrategy

src.modules.backend.solver.MinimaxStrategy

alias of StatelessMinimaxStrategy

src.modules.backend.solver.TwoStepStrategy

alias of StatelessTwoStepStrategy

src.modules.backend.solver.WeightedGainStrategy

alias of StatelessWeightedGainStrategy

src.modules.backend.solver.StrategyFactory

alias of ModernizedStrategyFactory