head	1.1;
access;
symbols
	netbsd-10-2-RELEASE:1.1
	netbsd-11-0-RELEASE:1.1
	netbsd-11-0-RC7:1.1
	netbsd-11-0-RC6:1.1
	netbsd-11-0-RC5:1.1
	netbsd-11-0-RC4:1.1
	netbsd-11-0-RC3:1.1
	netbsd-11-0-RC2:1.1
	netbsd-11-0-RC1:1.1
	perseant-exfatfs-base-20250801:1.1
	netbsd-11:1.1.0.10
	netbsd-11-base:1.1
	netbsd-10-1-RELEASE:1.1
	perseant-exfatfs-base-20240630:1.1
	perseant-exfatfs:1.1.0.8
	perseant-exfatfs-base:1.1
	netbsd-10-0-RELEASE:1.1
	netbsd-10-0-RC6:1.1
	netbsd-10-0-RC5:1.1
	netbsd-10-0-RC4:1.1
	netbsd-10-0-RC3:1.1
	netbsd-10-0-RC2:1.1
	netbsd-10-0-RC1:1.1
	netbsd-10:1.1.0.6
	netbsd-10-base:1.1
	cjep_sun2x-base1:1.1
	cjep_sun2x:1.1.0.4
	cjep_sun2x-base:1.1
	cjep_staticlib_x-base1:1.1
	cjep_staticlib_x:1.1.0.2
	cjep_staticlib_x-base:1.1;
locks; strict;
comment	@# @;


1.1
date	2020.10.03.17.30.54;	author rillig;	state Exp;
branches;
next	;
commitid	511VFlfoDxDDRtqC;


desc
@@


1.1
log
@make(1): add test demonstrating the Towers of Hanoi puzzle

It's not the primary task of make to handle procedure calls with
parameters, combined with lexical scoping, therefore the code does not
look as straight-forward or clean as in other programming languages.  It
feels more like squeezing a programming problem from the imperative
world into the world of declarative dependencies.

A more idiomatic way of implementing this puzzle should be as a
dependency graph since that's both the natural structure of the puzzle
and the primary domain of make.  Something like having a main target
"hanoi-5" that depends on intermediate targets of the form
"move-1.2.3.4.5-_._._._._-_._._._._", each representing a single
configuration of the stacks.  These targets could be generated
dynamically.  A benefit of this implementation would be that the puzzle
could be resumed from an arbitrary configuration, just just from the
initial configuration.
@
text
@Move the upper disk from stack A to stack C.
Move the upper disk from stack A to stack B.
Move the upper disk from stack C to stack B.
Move the upper disk from stack A to stack C.
Move the upper disk from stack B to stack A.
Move the upper disk from stack B to stack C.
Move the upper disk from stack A to stack C.
Move the upper disk from stack A to stack B.
Move the upper disk from stack C to stack B.
Move the upper disk from stack C to stack A.
Move the upper disk from stack B to stack A.
Move the upper disk from stack C to stack B.
Move the upper disk from stack A to stack C.
Move the upper disk from stack A to stack B.
Move the upper disk from stack C to stack B.
Move the upper disk from stack A to stack C.
Move the upper disk from stack B to stack A.
Move the upper disk from stack B to stack C.
Move the upper disk from stack A to stack C.
Move the upper disk from stack B to stack A.
Move the upper disk from stack C to stack B.
Move the upper disk from stack C to stack A.
Move the upper disk from stack B to stack A.
Move the upper disk from stack B to stack C.
Move the upper disk from stack A to stack C.
Move the upper disk from stack A to stack B.
Move the upper disk from stack C to stack B.
Move the upper disk from stack A to stack C.
Move the upper disk from stack B to stack A.
Move the upper disk from stack B to stack C.
Move the upper disk from stack A to stack C.
exit status 0
@
