summaryrefslogtreecommitdiffstats
path: root/hacks/munch.man
blob: d5423c9876b24af42c979d922fff16ca447f670d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
.de EX		\"Begin example
.ne 5
.if n .sp 1
.if t .sp .5
.nf
.in +.5i
..
.de EE
.fi
.in -.5i
.if n .sp 1
.if t .sp .5
..
.TH XScreenSaver 1 "29-Aug-2008" "X Version 11"
.SH NAME
munch - munching squares
.SH SYNOPSIS
.B munch
[\-display \fIhost:display.screen\fP] [\-foreground \fIcolor\fP]
[\-background \fIcolor\fP] [\-window] [\-root] [\-mono] [\-install]
[\-visual \fIvisual\fP] [\-delay \fIusecs\fP] [\-xor] [\-noxor] 
[\-clear \fInumber\fP] [\-simul \fInumber\fP]
[\-classic | \-mismunch | \-random]
[\-fps]
.SH DESCRIPTION
The
.I munch
program performs the munching squares hack.  It picks square
size, position, and gravity randomly.  It also displays a
creatively broken misimplementation of the classic algorithm.

The munching squares hack consists of drawing Y = X XOR T for a range of X
and T over and over until all the possible combinations of X and T have
come up.  It was reportedly discovered by Jackson Wright in 1962 and took 5
instructions of PDP-6 code.
.SH OPTIONS
.I munch
accepts the following options:
.TP 8
.B \-window
Draw on a newly-created window.  This is the default.
.TP 8
.B \-root
Draw on the root window.
.TP 8
.B \-mono 
If on a color display, pretend we're on a monochrome display.
.TP 8
.B \-install
Install a private colormap for the window.
.TP 8
.B \-visual \fIvisual\fP
Specify which visual to use.  Legal values are the name of a visual class,
or the id number (decimal or hex) of a specific visual.
.TP 8
.B \-delay \fIusecs\fP
The delay between steps of the animation, in microseconds.  Default: 2500.
.TP 8
.B \-xor
Use the XOR drawing function.  This is the default.
.TP 8
.B \-no\-xor
Don't use the XOR drawing function.
.TP 8
.B \-clear \fInumber\fP
Number of squares to misdraw before clearing the display.  Default: 65.
.TP 8
.B \-simul \fInumber\fP
Number of squares to misdraw simultaneously.  Default: 5.
.TP 8
.B \-classic
Draw classic munching squares only.
.TP 8
.B \-mismunch
Draw "mismunch" only.
.TP 8
.B \-random
Do one or the other.
.TP 8
.B \-fps
Display the current frame rate and CPU load.
.SH ENVIRONMENT
.PP
.TP 8
.B DISPLAY
to get the default host and display number.
.TP 8
.B XENVIRONMENT
to get the name of a resource file that overrides the global resources
stored in the RESOURCE_MANAGER property.
.SH SEE ALSO
.BR X (1),
.BR xscreensaver (1),
.RS 0
.BR http://www.inwap.com/pdp10/hbaker/hakmem/hakmem.html
.SH HISTORY
HAKMEM: MIT AI Memo 239, Feb. 29, 1972.
.RS 8
Beeler, M., Gosper, R.W., and Schroeppel, R.

"Unless otherwise stated, all computer programs are in PDP-6/10
assembly language."
.TP 4
ITEM 146: MUNCHING SQUARES

Another simple display program. It is thought that this was discovered by
Jackson Wright on the RLE PDP-1 circa 1962.

.EX
    DATAI 2
    ADDB 1,2
    ROTC 2,-22
    XOR 1,2
    JRST .-4
.EE
.RS 4
2=X, 3=Y. Try things like 1001002 in data switches. This also does
interesting things with operations other than XOR, and rotations other 
than -22. (Try IOR; AND; TSC; FADR; FDV(!); ROT -14, -9, -20, ...)
.RE
.TP 4
ITEM 147 (Schroeppel):

Munching squares is just views of the graph Y = X XOR T for consecutive
values of T = time.
.TP 4
ITEM 148 (Cohen, Beeler):

A modification to munching squares which reveals them in frozen states
through opening and closing curtains: insert FADR 2,1 before the XOR. Try
data switches =

.EX
    4000,,4    1000,,2002    2000,,4    0,,1002
.EE
.RS 4
(Notation: <left half>,,<right half>)
.RS 0
Also try the FADR after the XOR, switches = 1001,,1. 
.SH COPYRIGHT
Copyright 1997 Tim Showalter.
.RS 0
Copyright 2004 Steven Hazel.
.RS 0
Copyright 1992-2008 Jamie Zawinski.
.PP
Permission to use, copy, modify, distribute, and sell this software
and its documentation for any purpose is hereby granted without fee,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation.  No representations are made about the
suitability of this software for any purpose.  It is provided "as is"
without express or implied warranty.