kernelthread.com

Yoix

The Towers of Hanoi as a Yoix program.

Yoix is a scripting language developed by AT&T Research. More information can be had from the Yoix website.

// The Towers Of Hanoi // Yoix // Copyright (C) 2003 Amit Singh. All Rights Reserved. // http://hanoi.kernelthread.com // // Tested under Yoix Version 1.1.0 // http://www.research.att.com/sw/tools/yoix/ // <yoix@research.att.com> int maxdsks = 10; h(n, f, u, t) { if (n == 1) yoix.stdio.fprintf(stdout, "%d --> %d\n", f, t); else { h(n - 1, f, t, u); yoix.stdio.fprintf(stdout, "%d --> %d\n", f, t); h(n - 1, u, f, t); } } hanoi(n) { if ((n < 1) || (n > maxdsks)) yoix.stdio.fprintf(stderr, "number of disks n, 0 < n <= %d\n", maxdsks); else h(n, 1, 2, 3); }

Download

hanoi.yx