Initial project import

This commit is contained in:
Agila Forge Importer committed 2026-07-13 15:20:32 +00:00
commit 23f2d29e32
11957 files changed
+1754577

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
// hanoi tower
const num = 7
fn main() {
hanoi(num, 'A', 'B', 'C')
}
fn move(n int, a string, b string) {
println('Disc ${n} from ${a} to ${b}...')
}
fn hanoi(n int, a string, b string, c string) {
if n == 1 {
move(1, a, c)
} else {
hanoi(n - 1, a, c, b)
move(n, a, c)
hanoi(n - 1, b, a, c)
}
}