"""Create reasoning_engine
Generated by Phi-Octopus Eden
2025-11-08 12:23:43.130905
"""

```python
from typing import List, Dict


class ReasoningEngine:
    """
    A simple reasoning engine that attempts to solve a limited set of problems.
    This engine can evaluate conditions based on a set of rules and provide logical outcomes.

    Args:
        rules: A list of dictionaries containing 'condition' and 'action'.
               Each rule should have the structure {'condition': lambda x: ..., 'action': lambda x: ...}

    Example usage:
        rules = [
            {
                'condition': lambda x: x['temperature'] > 30,
                'action': lambda x: f"Temperature is high, cool down to {x['target_temp']} degrees."
            },
            {
                'condition': lambda x: x['humidity'] < 20,
                'action': lambda x: "Humidity is low, increase it by 15%."
            }
        ]
        engine = ReasoningEngine(rules)
        response = engine.reason({'temperature': 35, 'humidity': 18})
        print(response)  # Output should be "Temperature is high, cool down to <target_temp> degrees."

    """

    def __init__(self, rules: List[Dict[str, lambda]]):
        self.rules = rules

    def reason(self, context: Dict) -> str:
        """
        Apply the reasoning engine's rules based on the given context and return an action.

        Args:
            context: A dictionary containing key-value pairs that represent the current state.

        Returns:
            The logical outcome as a string.
        """
        for rule in self.rules:
            if rule['condition'](context):
                return rule['action'](context)
        return "No applicable rules found."

# Example usage
rules = [
    {
        'condition': lambda x: x['temperature'] > 30,
        'action': lambda x: f"Temperature is high, cool down to {x['target_temp']} degrees."
    },
    {
        'condition': lambda x: x['humidity'] < 20,
        'action': lambda x: "Humidity is low, increase it by 15%."
    }
]

engine = ReasoningEngine(rules)
response = engine.reason({'temperature': 35, 'humidity': 18})
print(response)  # Output should be "Temperature is high, cool down to <target_temp> degrees."

# Another usage example
response2 = engine.reason({'temperature': 25, 'humidity': 22})
print(response2)  # Output should be "Humidity is low, increase it by 15%."
```