-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstochastic texts editing.html
160 lines (150 loc) · 5.99 KB
/
stochastic texts editing.html
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
154
155
156
157
158
159
160
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<!--
Love Letters reimplementation
copyright (c) 2014 Nick Montfort <[email protected]>
based on a 1952 program by Christopher Strachey
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Updated 10 March 2015 to correct the word lists. Sources are photographs
of Christoper Stachey's notes in the Bodleian Library from J.R. Carpenter
and table 14.1 in Noah Wardrip-Fruin's article "Digital Media Archaeology."
Updated 28 August 2019 to add a link to "The Ferranti Mark 1 Gallery."
-->
<style type="text/css">
/* <![CDATA[ */
body {
background:#000;
color:#ccc;
margin:0 0 0 18pt;
font-family:Optima, sans-serif;
font-size:16pt;
}
a {
color:#117;
text-decoration:none;
}
#main {
padding-top:18px;
width:70%;
}
#main div {
font-weight:bold;
padding-bottom:9px;
}
#info {
top:0;
right:0;
bottom:0;
position:absolute;
height:100%;
width:25%;
color:#333;
background:#999;
margin-left:6px;
border-left:thin #000 solid;
border-bottom:thin #000 solid;
padding:9px;
font-size:80%
}
/* ]]> */
</style>
<script type="text/javascript">
var t = 0,
first = ['DARLING', 'DEAR', 'HONEY', 'JEWEL'],
second = ['DUCK', 'LOVE', 'MOPPET', 'SWEETHEART'],
adjectives = ['ADORABLE', 'AFFECTIONATE', 'AMOROUS', 'ANXIOUS', 'ARDENT', 'AVID', 'BREATHLESS', 'BURNING', 'COVETOUS', 'CRAVING', 'CURIOUS', 'DARLING', 'DEAR', 'DEVOTED', 'EAGER', 'EROTIC', 'FERVENT', 'FOND', 'IMPATIENT', 'KEEN', 'LITTLE', 'LOVEABLE', 'LOVESICK', 'LOVING', 'PASSIONATE', 'PRECIOUS', 'SWEET', 'SYMPATHETIC', 'TENDER', 'UNSATISFIED', 'WISTFUL'],
nouns = ['ADORATION', 'AFFECTION', 'AMBITION', 'APPETITE', 'ARDOUR', 'CHARM', 'DESIRE', 'DEVOTION', 'EAGERNESS', 'ENCHANTMENT', 'ENTHUSIASM', 'FANCY', 'FELLOW FEELING', 'FERVOUR', 'FONDNESS', 'HEART', 'HUNGER', 'INFATUATION', 'LIKING', 'LONGING', 'LOVE', 'LUST', 'PASSION', 'RAPTURE', 'SYMPATHY', 'TENDERNESS', 'THIRST', 'WISH', 'YEARNING'],
adverbs = ['AFFECTIONATELY', 'ANXIOUSLY', 'ARDENTLY', 'AVIDLY', 'BEAUTIFULLY', 'BREATHLESSLY', 'BURNINGLY', 'COVETOUSLY', 'CURIOUSLY', 'DEVOTEDLY', 'EAGERLY', 'FERVENTLY', 'FONDLY', 'IMPATIENTLY', 'KEENLY', 'LOVINGLY', 'PASSIONATELY', 'SEDUCTIVELY', 'TENDERLY', 'WINNINGLY', 'WISTFULLY'],
verbs = ['ADORES', 'ATTRACTS', 'CARES FOR', 'CHERISHES', 'CLINGS TO', 'DESIRES','HOLDS DEAR', 'HOPES FOR', 'HUNGERS FOR', 'IS WEDDED TO', 'LIKES', 'LONGS FOR', 'LOVES', 'LUSTS AFTER', 'PANTS FOR', 'PINES FOR', 'PRIZES', 'SIGHS FOR', 'TEMPTS', 'THIRSTS FOR', 'TREASURES', 'WANTS', 'WISHES', 'WOOS', 'YEARNS FOR'];
function rand_range(maximum) {
"use strict";
return Math.floor(Math.random() * (maximum + 1));
}
function choose(array) {
"use strict";
return array[rand_range(array.length - 1)];
}
function maybe(words) {
"use strict";
if (Math.random() > 0.5) {
return ' ' + choose(words);
}
return '';
}
function longer() {
"use strict";
return ' MY' + maybe(adjectives) + ' ' + choose(nouns) + maybe(adverbs) + ' ' + choose(verbs) + ' YOUR' + maybe(adjectives) + ' ' + choose(nouns) + '.';
}
function shorter() {
"use strict";
return ' ' + choose(adjectives) + ' ' + choose(nouns) + '.';
}
function letter() {
"use strict";
var i, type, you_are = false, text = '';
text = text + choose(first) + ' ' + choose(second) + '<br /><br />';
for (i = 0; i < 5; i = i + 1) {
type = choose(['longer', 'shorter']);
if (type === 'longer') {
text = text + longer();
you_are = false;
} else {
if (you_are) {
text = text.slice(0, -1) + ': MY' + shorter();
you_are = false;
} else {
text = text + ' YOU ARE MY' + shorter();
you_are = true;
}
}
}
text = text + '<br /><br /> YOURS ' + choose(adverbs) + '<br /><br />' + ' M.U.C.';
return text;
}
function litany() {
"use strict";
var last, main = document.getElementById('main');
if (4 > t) {
t += 1;
} else {
main.removeChild(document.getElementById('main').firstChild);
}
last = document.createElement('div');
last.innerHTML = letter();
main.appendChild(last);
}
function produce_litany() {
"use strict";
litany();
setInterval(litany, 5000);
}
</script>
<title>Love Letters</title>
</head>
<body onload="produce_litany();">
<div id="info">
<h2>Love Letters</h2>
<h3>Christopher Strachey</h3>
1952<br />
<a href="http://curation.cs.manchester.ac.uk/digital60/www.digital60.org/rebuild/50th/gallery/gallery2/index.html">Ferranti Mark 1</a><br />
Autocode<br />
<br />
Reimplemented by<br />
<a href="http://nickm.com">Nick Montfort</a><br />
for <a href="http://nickm.com/memslam/">Memory Slam</a><br />
Also: a <a href="love_letters.py">Python 2/3</a> version
</div>
<div id="main"></div>
</body>
</html>