hanoi.m4 revision 16748
175584Sru# $OpenBSD: hanoi.m4,v 1.2 1996/06/26 05:36:19 deraadt Exp $ 275584Sru# $NetBSD: hanoi.m4,v 1.4 1995/09/28 05:37:56 tls Exp $ 375584Sru# 475584Sru# Copyright (c) 1989, 1993 575584Sru# The Regents of the University of California. All rights reserved. 675584Sru# 775584Sru# This code is derived from software contributed to Berkeley by 875584Sru# Ozan Yigit. 975584Sru# 1075584Sru# Redistribution and use in source and binary forms, with or without 1175584Sru# modification, are permitted provided that the following conditions 1275584Sru# are met: 1375584Sru# 1. Redistributions of source code must retain the above copyright 1475584Sru# notice, this list of conditions and the following disclaimer. 1575584Sru# 2. Redistributions in binary form must reproduce the above copyright 1675584Sru# notice, this list of conditions and the following disclaimer in the 1775584Sru# documentation and/or other materials provided with the distribution. 1875584Sru# 3. All advertising materials mentioning features or use of this software 1975584Sru# must display the following acknowledgement: 2075584Sru# This product includes software developed by the University of 2175584Sru# California, Berkeley and its contributors. 2275584Sru# 4. Neither the name of the University nor the names of its contributors 2375584Sru# may be used to endorse or promote products derived from this software 2475584Sru# without specific prior written permission. 2575584Sru# 2675584Sru# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2775584Sru# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2875584Sru# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2975584Sru# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 3075584Sru# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 3175584Sru# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 3275584Sru# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 3375584Sru# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3475584Sru# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3575584Sru# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3675584Sru# SUCH DAMAGE. 3775584Sru# 3875584Sru# @(#)hanoi.m4 8.1 (Berkeley) 6/6/93 3975584Sru# 4075584Sru 4175584Srudefine(hanoi, `trans(A, B, C, $1)') 4275584Sru 4375584Srudefine(moved,`move disk from $1 to $2 4475584Sru') 4575584Sru 4675584Srudefine(trans, `ifelse($4,1,`moved($1,$2)', 4775584Sru `trans($1,$3,$2,DECR($4))moved($1,$2)trans($3,$2,$1,DECR($4))')') 4875584Sru