xref: /csrg-svn/usr.bin/m4/TEST/hanoi.m4 (revision 38814)
1*38814Sbostic#
2*38814Sbostic# Copyright (c) 1989 The Regents of the University of California.
3*38814Sbostic# All rights reserved.
4*38814Sbostic#
5*38814Sbostic# This code is derived from software contributed to Berkeley by
6*38814Sbostic# Ozan Yigit.
7*38814Sbostic#
8*38814Sbostic# Redistribution and use in source and binary forms are permitted
9*38814Sbostic# provided that the above copyright notice and this paragraph are
10*38814Sbostic# duplicated in all such forms and that any documentation,
11*38814Sbostic# advertising materials, and other materials related to such
12*38814Sbostic# distribution and use acknowledge that the software was developed
13*38814Sbostic# by the University of California, Berkeley.  The name of the
14*38814Sbostic# University may not be used to endorse or promote products derived
15*38814Sbostic# from this software without specific prior written permission.
16*38814Sbostic# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
17*38814Sbostic# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
18*38814Sbostic# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19*38814Sbostic#
20*38814Sbostic#	@(#)hanoi.m4	5.1 (Berkeley) 08/28/89
21*38814Sbostic#
22*38814Sbostic
23*38814Sbosticdefine(hanoi, `trans(A, B, C, $1)')
24*38814Sbostic
25*38814Sbosticdefine(moved,`move disk from $1 to $2
26*38814Sbostic')
27*38814Sbostic
28*38814Sbosticdefine(trans, `ifelse($4,1,`moved($1,$2)',
29*38814Sbostic	`trans($1,$3,$2,DECR($4))moved($1,$2)trans($3,$2,$1,DECR($4))')')
30