1 ! Copyright (C) 2019-2020 KUSUMOTO Norio.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: logic lists sequences assocs formatting ;
4 IN: logic.examples.hanoi2
6 LOGIC-PREDS: hanoi write-move ;
7 LOGIC-VARS: A B C X Y Z ;
9 { write-move X } [ X of [ printf ] each t ] callback
11 { hanoi L{ } A B C } fact
13 { hanoi L{ X . Y } A B C } {
15 { write-move { "move " X " from " A " to " B "\n" } }