From 99ec17a582ce40c35e9be76415b3a4a6dcff65ae Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Thu, 9 May 2024 16:26:06 +0200 Subject: Another rosetta sync --- samples/rosetta/towers_of_hanoi.bruijn | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 samples/rosetta/towers_of_hanoi.bruijn (limited to 'samples/rosetta/towers_of_hanoi.bruijn') diff --git a/samples/rosetta/towers_of_hanoi.bruijn b/samples/rosetta/towers_of_hanoi.bruijn new file mode 100644 index 0000000..afebb12 --- /dev/null +++ b/samples/rosetta/towers_of_hanoi.bruijn @@ -0,0 +1,10 @@ +:import std/Combinator . +:import std/Number . +:import std/String . + +hanoi y [[[[=?2 empty go]]]] + go [(4 --3 2 0) ++ str ++ (4 --3 0 1)] ((+6) - 1 - 0) + str "Move " ++ disk ++ " from " ++ source ++ " to " ++ destination ++ "\n" + disk number→string 3 + source number→string 2 + destination number→string 1 -- cgit v1.2.3