diff options
| author | Shinya Sato <shinnya.sato@gmail.com> | 2024-03-05 18:19:27 +0900 |
|---|---|---|
| committer | Shinya Sato <shinnya.sato@gmail.com> | 2024-03-05 18:19:27 +0900 |
| commit | 49960d8950d001a372a0abde670a66ee60026957 (patch) | |
| tree | adad1d5fe428bf0bea151f71ed114223fc246bca /sample/hanoi.in | |
| parent | 0cf73da9ad035089c66d21021a656e4606796c47 (diff) | |
| download | inpla-49960d8950d001a372a0abde670a66ee60026957.tar.gz inpla-49960d8950d001a372a0abde670a66ee60026957.zip | |
v0.12.0
Diffstat (limited to 'sample/hanoi.in')
| -rw-r--r-- | sample/hanoi.in | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/sample/hanoi.in b/sample/hanoi.in deleted file mode 100644 index 5be47c6..0000000 --- a/sample/hanoi.in +++ /dev/null @@ -1,30 +0,0 @@ -// Tower of Hanoi Puzzle - -// Rules -hanoi(return, source, target, aux) >< (int n) -| n==0 => - // Erase the source, target and aux - source ~ Eraser, - target ~ Eraser, - aux ~ Eraser, - - // result - return~[] - -| _ => - // Duplicate the source, target and aux - source ~ Dup(src1, Dup(src2, src3)), - target ~ Dup(tgt1, Dup(tgt2, tgt3)), - aux ~ Dup(aux1, aux2), - - // recursive applications - hanoi(ret1, src1, aux1, tgt1)~(n-1), - hanoi(ret2, aux2, tgt2, src2)~(n-1), - - // result - return << Append(ret1, (n,src3,tgt3):ret2); - - -// Net -hanoi(result, A, C, B) ~ 3; -result; // should be [(1,A,C),(2,A,B),(1,C,B),(3,A,C),(1,B,A),(2,B,C),(1,A,C)] |
