# Compare a direct ReAct-style plan with a small set of candidate plans.
def react(goal):
    print("ReAct: think -> act -> observe")
    return ["Read topic", "Solve practice questions", "Check answers"]

def tree_of_thoughts(goal):
    candidates = {
        "Plan A": ["Read topic", "Solve questions", "Review mistakes"],
        "Plan B": ["Watch tutorial", "Read topic", "Solve questions"],
        "Plan C": ["Start mock test", "Review notes"]
    }
    # Demo scoring favors plans containing practice and review.
    scored = [(sum(word in " ".join(tasks).lower()
                   for word in ("solve", "review")), name, tasks)
              for name, tasks in candidates.items()]
    return max(scored, key=lambda item: item[0])

goal = input("Enter goal: ")
print("Goal:", goal)
print("ReAct plan:", react(goal))
score, name, plan = tree_of_thoughts(goal)
print("Selected ToT branch:", name, "score:", score)
print("Plan:", plan)
