Menu

[r376]: / XHANOI.MPL  Maximize  Restore  History

Download this file

22 lines (14 with data), 395 Bytes

/*
  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

  CONVERTED TO MPL BY DEREK JOHN EVANS
*/

##LIBHDR

MOVEIT(F,T) WRITEF("MOVE %N --> %N*N",F,T)

HANOI(N,T,F,U) N ? [
  HANOI(N-1,U,F,T); MOVEIT(F,T); HANOI(N-1,T,U,F)
]

.() HANOI(5,3,1,2)
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.