"""Create reasoning_engine
Generated by Phi-Octopus Eden
2025-11-07 18:54:04.105261
"""

```python
from typing import List, Dict


class ReasoningEngine:
    """
    A simple reasoning engine to solve problems with limited reasoning sophistication.
    It can evaluate conditions based on a set of rules and return conclusions.

    Args:
        rules: A list of dictionaries where each dictionary represents a rule in the format:
               {'if': [conditions], 'then': conclusion}
               Conditions are evaluated as boolean expressions, and conclusions are strings or values.

    Methods:
        __init__(self, rules: List[Dict]):
            Initializes the ReasoningEngine with given rules.
        
        evaluate(self) -> str | bool | int:
            Evaluates all the conditions in each rule and returns the conclusion based on the first true condition.

    Example usage:
        engine = ReasoningEngine([
            {'if': ['temperature > 30', 'humidity < 50'], 'then': 'Turn on AC'},
            {'if': ['rain == True'], 'then': False},
            {'if': [], 'then': 'System is idle'}
        ])
        result = engine.evaluate()
    """

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

    def evaluate(self) -> str | bool | int:
        for rule in self.rules:
            if all(eval(condition.strip()) for condition in rule['if']):
                return rule['then']
        return "No action"

# Example usage
rules = [
    {'if': ['temperature > 30', 'humidity < 50'], 'then': 'Turn on AC'},
    {'if': ['rain == True'], 'then': False},
    {'if': [], 'then': 'System is idle'}
]

engine = ReasoningEngine(rules)
result = engine.evaluate()
print(result)  # Output: Turn on AC
```