Add --debug flag to Zork 1 smoke test
This commit is contained in:
parent
48727c4690
commit
2cf303dd67
1 changed files with 8 additions and 1 deletions
|
|
@ -1,12 +1,17 @@
|
||||||
#!/usr/bin/env -S uv run --script
|
#!/usr/bin/env -S uv run --script
|
||||||
"""Smoke test for hybrid z-machine interpreter with Zork 1."""
|
"""Smoke test for hybrid z-machine interpreter with Zork 1."""
|
||||||
|
|
||||||
|
import argparse
|
||||||
import sys
|
import sys
|
||||||
import traceback
|
import traceback
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
parser = argparse.ArgumentParser(description="Run Zork 1 in Z-machine interpreter")
|
||||||
|
parser.add_argument("--debug", action="store_true", help="Enable debug mode")
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
# Add src to path so we can import mudlib
|
# Add src to path so we can import mudlib
|
||||||
project_root = Path(__file__).parent.parent
|
project_root = Path(__file__).parent.parent
|
||||||
sys.path.insert(0, str(project_root / "src"))
|
sys.path.insert(0, str(project_root / "src"))
|
||||||
|
|
@ -38,9 +43,11 @@ def main():
|
||||||
print(f"Loaded {len(story_bytes)} bytes")
|
print(f"Loaded {len(story_bytes)} bytes")
|
||||||
print()
|
print()
|
||||||
print("Creating ZUI and ZMachine instance...")
|
print("Creating ZUI and ZMachine instance...")
|
||||||
|
if args.debug:
|
||||||
|
print("Debug mode: ENABLED")
|
||||||
|
|
||||||
ui = create_zui()
|
ui = create_zui()
|
||||||
zmachine = ZMachine(story_bytes, ui, debugmode=False)
|
zmachine = ZMachine(story_bytes, ui, debugmode=args.debug)
|
||||||
|
|
||||||
print("Starting interpreter...")
|
print("Starting interpreter...")
|
||||||
print("(Press Ctrl+C to exit)")
|
print("(Press Ctrl+C to exit)")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue