Closed wixette closed 1 year ago
"C" should be the target tower, and "B" should be the auxiliary tower.
After this fix, the output of the Hanoi script:
dotnet run --project csharp/src/SeedLang.Shell -- -f example_scripts/seedpython/hanoi.py SeedLang.Shell 0.3.0-preview20220923142436 Copyright 2021-2022 The SeedV Lab. Enabled Visualizers: ---------- Source ---------- 1 # Tower of Hanoi problem. 2 def move(n, source, target, auxiliary): 3 if n <= 0: 4 return 5 move(n - 1, source, auxiliary, target) 6 print('Tower ' + source + ' -> Tower ' + target) 7 move(n - 1, auxiliary, target, source) 8 9 10 num = 3 11 move(num, 'A', 'C', 'B') ---------- Run ---------- Tower A -> Tower C Tower A -> Tower B Tower C -> Tower B Tower A -> Tower C Tower B -> Tower A Tower B -> Tower C Tower A -> Tower C
"C" should be the target tower, and "B" should be the auxiliary tower.
After this fix, the output of the Hanoi script: