Towers of Hanoi: Difference between revisions
→{{header|Picat}}: Fixed tags, removed comment about table/0
(→{{header|Picat}}: Fixed tags, removed comment about table/0) |
|||
Line 4,435:
=={{header|Picat}}==
This uses tabling, of course.
<lang Picat>main =>
hanoi(3,true),
nl,
hanoi(24,false),
hanoi(64,false),
nl.
Line 4,450 ⟶ 4,451:
nl.
table
move(0, _From, _To, _Via, _Print) = 0 => true.
Line 4,459 ⟶ 4,458:
printf("Move disk %w from pole %w to pole %w\n", N, From, To)
end,
Count2 =
Count = Count1+Count2+1.</lang>
{{out}}
Line 4,474 ⟶ 4,473:
N=24
count=16777215, theoretical=16777215
▲ end,
<pre>N=64▼
count=18446744073709551615, theoretical=18446744073709551615▼
▲count=18446744073709551615, theoretical=18446744073709551615</pre>
=={{header|PicoLisp}}==
|