-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
51 lines (41 loc) · 1.42 KB
/
main.py
File metadata and controls
51 lines (41 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
"""GeoGebra Python指令系统主脚本"""
from .commands.processor import GeoGebraCommandProcessor
from .commands.registry import Commands
from .validation.core import CommandValidator
def main():
"""主函数"""
print("GeoGebra Python Command System")
print("=" * 50)
# 显示所有注册的指令
print("\nRegistered Commands:")
print("-" * 30)
all_commands = Commands.get_all_commands()
for i, (name, info) in enumerate(all_commands.items(), 1):
print(f"{i}. {name} ({info.category.value})")
for signature in info.signatures:
print(f" {signature}")
# 创建指令处理器
processor = GeoGebraCommandProcessor()
# 示例指令处理
print("\nExample Command Processing:")
print("-" * 30)
# 测试几何指令
examples = [
("Point", [(0, 0), (1, 1)]),
("Line", [(0, 0), (1, 1)]),
("Circle", [(0, 0), 1]),
("Distance", [(0, 0), (3, 4)]),
("Mod", [10, 3]),
("GCD", [12, 18]),
("Sphere", [(0, 0), 5]),
]
for command_name, arguments in examples:
try:
result = processor.process(command_name, arguments)
print(f"{command_name}{arguments} = {result}")
except Exception as e:
print(f"{command_name}{arguments} = ERROR: {e}")
print("\n" + "=" * 50)
print("System ready!")
if __name__ == "__main__":
main()