lwgray / think

MIT License
0 stars 1 forks source link

Enhanced ThinkPy Interpreter with Multiple Output Styles Fix #7 #8

Closed lwgray closed 1 week ago

lwgray commented 1 week ago

Overview

This PR significantly improves the ThinkPy interpreter's output capabilities and fixes several issues. It adds multiple output formatting styles, including an educational mode with emoji indicators, and fixes a condition evaluation bug in elif statements.

Key Changes

1. New Output Formatting Styles

Added six different output styles:

2. Bug Fixes

3. Educational Enhancements

4. Code Structure Improvements

Breaking Changes

This PR includes breaking changes to the interpreter's initialization:

# Old
interpreter = ThinkPyInterpreter(explain_mode=False)

# New
interpreter = ThinkPyInterpreter(
    explain_mode=False,
    format_style="default",
    max_iterations_shown=5
)

Testing Done

Usage Examples

# Educational mode
%%thinkpy --explain --style educational
objective "Test program"
task "Example" { ... }

# Markdown style
%%thinkpy --explain --style markdown
objective "Test program"
task "Example" { ... }

# Limit iterations
%%thinkpy --explain --max-iterations 3
objective "Test program"
task "Example" { ... }

Documentation Updates

Related Issues

Closes #7 (Output formatting enhancement request) Fixes #7 (elif condition evaluation bug)

Review Notes

Please pay special attention to: