// // The Towers Of Hanoi // BCPL // Copyright (C) 1998 Amit Singh. All Rights Reserved. // http://hanoi.kernelthread.com // // Tested under Martin Richards' BCPL over INTCODE compiler kit // GLOBAL $( START:1; WRITEF:76 $) LET MOVEIT(F, T) BE $( WRITEF("move %N --> %N*N", F, T) $) LET HANOI(N, T, F, U) BE $( IF N=0 RETURN; HANOI(N-1, U, F, T); MOVEIT(F, T); HANOI(N-1, T, U, F) $) // Don't know if there's something like `argv' in BCPL. // The first argument of HANOI is the number of disks, which is hardcoded. LET START () BE $(1 HANOI(1, 3, 1, 2) FINISH $)1