hanoi.m4 revision 1590
11590Srgrimes# 21590Srgrimes# Copyright (c) 1989, 1993 31590Srgrimes# The Regents of the University of California. All rights reserved. 41590Srgrimes# 51590Srgrimes# This code is derived from software contributed to Berkeley by 61590Srgrimes# Ozan Yigit. 71590Srgrimes# 81590Srgrimes# Redistribution and use in source and binary forms, with or without 91590Srgrimes# modification, are permitted provided that the following conditions 101590Srgrimes# are met: 111590Srgrimes# 1. Redistributions of source code must retain the above copyright 121590Srgrimes# notice, this list of conditions and the following disclaimer. 131590Srgrimes# 2. Redistributions in binary form must reproduce the above copyright 141590Srgrimes# notice, this list of conditions and the following disclaimer in the 151590Srgrimes# documentation and/or other materials provided with the distribution. 161590Srgrimes# 3. All advertising materials mentioning features or use of this software 171590Srgrimes# must display the following acknowledgement: 181590Srgrimes# This product includes software developed by the University of 191590Srgrimes# California, Berkeley and its contributors. 201590Srgrimes# 4. Neither the name of the University nor the names of its contributors 211590Srgrimes# may be used to endorse or promote products derived from this software 221590Srgrimes# without specific prior written permission. 231590Srgrimes# 241590Srgrimes# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 251590Srgrimes# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 261590Srgrimes# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 271590Srgrimes# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 281590Srgrimes# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 291590Srgrimes# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 301590Srgrimes# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 311590Srgrimes# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 321590Srgrimes# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 331590Srgrimes# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 341590Srgrimes# SUCH DAMAGE. 351590Srgrimes# 361590Srgrimes# @(#)hanoi.m4 8.1 (Berkeley) 6/6/93 371590Srgrimes# 381590Srgrimes 391590Srgrimesdefine(hanoi, `trans(A, B, C, $1)') 401590Srgrimes 411590Srgrimesdefine(moved,`move disk from $1 to $2 421590Srgrimes') 431590Srgrimes 441590Srgrimesdefine(trans, `ifelse($4,1,`moved($1,$2)', 451590Srgrimes `trans($1,$3,$2,DECR($4))moved($1,$2)trans($3,$2,$1,DECR($4))')') 46