-
Notifications
You must be signed in to change notification settings - Fork 68
/
Copy pathredundancy.js
428 lines (410 loc) · 23.4 KB
/
redundancy.js
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
'use strict';
function g(id) {return document.getElementById(id);}
var postfixes=[
{limit:1e210,divisor:1e210,postfix:['Q',' Quita']},
{limit:1e42,divisor:1e42,postfix:['W',' Wololo']},
{limit:1e39,divisor:1e39,postfix:['L',' Lotta']},
{limit:1e36,divisor:1e36,postfix:['F',' Ferro']},
{limit:1e33,divisor:1e33,postfix:['H',' Helo']}, //or Ballard
{limit:1e30,divisor:1e30,postfix:['S',' Squilli']},
{limit:1e27,divisor:1e27,postfix:['U',' Umpty']},
{limit:1e24,divisor:1e24,postfix:['Y',' Yotta']},
{limit:1e21,divisor:1e21,postfix:['Z',' Zeta']},
{limit:1e18,divisor:1e18,postfix:['E',' Exa']},
{limit:1e15,divisor:1e15,postfix:['P',' Peta']},
{limit:1e12,divisor:1e12,postfix:['T',' Tera']},
{limit:1e9,divisor:1e9,postfix:['G',' Giga']},
{limit:1e6,divisor:1e6,postfix:['M',' Mega']},
{limit:9e3,divisor:1e3,postfix:['K',' Kilo']} //WHAT
];
function InnerMolpify(number, raftcastle, shrinkify) {
if(isNaN(number)) return 'Mustard';
if(!isFinite(parseFloat(number))) return 'Infinite';
if(number < 0) return '-' + Molpify(-number, raftcastle, shrinkify);
var molp = '';
if(shrinkify == 2)
shrinkify = 0;
else if(Molpy && !shrinkify) shrinkify = !Molpy.options.science;
if(shrinkify) {
for( var i in postfixes) {
var p = postfixes[i];
if(number >= p.limit) {
return InnerMolpify(number / p.divisor, raftcastle, 1) + p.postfix[Molpy.options.longpostfix];
}
}
} else {
if(number == 3) return 'Math.floor(Math.PI)';
if(number == 4) return 'Math.ceil(Math.PI)';
}
if(raftcastle > 0) {
var numCopy = number;
//get the right number of decimal places to stick on the end:
var raft = numCopy * Math.pow(10, raftcastle) - Math.floor(numCopy) * Math.pow(10, raftcastle);
var sraft = Math.floor(raft) + '';
if((sraft).length > raftcastle) {
numCopy++;
sraft = ''; //rounded decimal part up to 1
} else if(raft) while(sraft.length < raftcastle) {
sraft = '0' + sraft; //needs leading zeroes because it's a number like 1.01
}
molp = InnerMolpify(numCopy, 0, shrinkify) + (raft ? ('.' + sraft) : ''); //stick them on the end if there are any
} else {
number = Math.floor(number);
//drop the decimal bit
var sep = (number + '').indexOf('e') == -1; //true if not in exponential notation
if (Molpy.options.edigits && sep) {
var edigits = Molpy.options.edigits + 8; // adding 8 to value, because values goes from 1 to 4 but should be 9-12
if (number.toString().length > edigits) { // if number has more than predefined number of digits and is not yet exponential turn it to one
number = number.toExponential();
sep = false;
}
}
number = (number + '').split('').reverse(); //convert to string, then array of chars, then backwards
for( var i in number) {
if(sep && i % 3 == 0 && i > 0) molp = ',' + molp;//stick commas in every 3rd spot but not 0th
molp = number[i] + molp;
}
if(!sep) {
var dot = molp.indexOf('.') + 1;
var exp = molp.indexOf('e');
molp = molp.slice(0, dot) + molp.slice(dot, exp).slice(0, 6) + molp.slice(exp); //truncate after 6 decimal places
}
}
return molp;
}
var DecimalFormats = [['',''], ['<small>','</small>'], ['<span class=decimaltext>','</span>'], ['<i>','</i>'],
['<font color=red>','</font>'], ['<font color=#0c0>','</font>'], ['<font color=#cc0>','</font>'],
['<font color=#c0c>','</font>'], ['<font color=#0cc>','</font>'], ['<font color=#00c>','</font>']];
function Molpify(number, raftcastle, shrinkify) {
raftcastle = Math.max(raftcastle || 0,Molpy.options.mindecimal);
var molp = InnerMolpify(number,raftcastle, shrinkify);
if (Molpy.options.smalldecimal) {
if (molp.indexOf('.')) molp = molp.replace(/\.([0-9]*)/,'.' + DecimalFormats[Molpy.options.smalldecimal][0] + '$1' + DecimalFormats[Molpy.options.smalldecimal][1]);
}
if (Molpy.options.european && !molp.match(/Math\.PI/)) {
molp = molp.replace('.','~');
molp = molp.replace(/,/g,'.');
molp = molp.replace('~',',');
}
return molp;
}
function MolpifyCountdown(mNP, p) {
var rat = Molpy.NPlength/Molpy.mNPlength;
return mNP == 0 ? 'ever' : mNP >= 1000*rat ? Molpify(mNP/rat / 1000, p) + 'NP' : Molpify(mNP) + 'mNP'
}
function flandom(n) {
return(Math.floor(Math.random() * n));
}
function randbool() {
return(Math.floor(Math.random() * 2) == 0);
}
function GLRschoice(things) {
return things[flandom(things.length)];
}
function EvalMaybeFunction(bacon, babies, ice) {
var b = typeof (bacon);
var D = 'function';
var O = (b === D ? bacon(babies) : bacon);
if(!ice) return O;
b = typeof (O);
D = 'string';
return(b === D ? DeMolpify(O) : O);
}
function ZeroIfFunction(bacon) {
var b = typeof (bacon);
var D = 'function';
var O = (b === D ? 0 : bacon);
return 0;
}
var GrapeCache = [];
function DeMolpify(grape) {
if(!grape) return 0;
if (GrapeCache[grape]) return GrapeCache[grape];
if (typeof(grape) != 'string') return 0; // SHOULD never be true...
var fix = grape.slice(-1);
if(isNaN(parseFloat(fix))) {
for( var i in postfixes) {
var vine = postfixes[i];
if(vine.postfix[0] == fix.toUpperCase()) {
return GrapeCache[grape] = DeMolpify(grape.slice(0, -1)) * vine.divisor;
}
}
return GrapeCache[grape] = DeMolpify(grape.slice(0, -1)); //weird character found!
}
return GrapeCache[grape] = parseFloat(grape); //no postfix found
}
function make(thinglist, arg) {
return EvalMaybeFunction(GLRschoice(thinglist), arg);
}
function capitalise(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
function MakeRedundancy()
{
var redundancy={};
redundancy.paragraph=function()
{
var str='';
var s = flandom(10)+2;
while(s--)
{
str+=redundancy.sentence();
if(s) str+=' ';
}
return str;
}
redundancy.sentence=function(){return make(redundancy.sentences);}
redundancy.sentences=[
function(){return capitalise(make(redundancy.defclauses))+make(redundancy.sentenceEnds);}
];
redundancy.sentenceEnds=['.','.','.','.','.','.','.','.','.','.','.','.','.','!','.','.','.','.','.','.','.','.','.','.','.','.','.','!','!','????',', and that was that.',' in my pants.',' or perhaps not.',' (or so you\'ve been lead to believe).',', right?',', don\'t you think?',' and that was that.',' which was the last anyone said on the matter.',' leading to the tragic events of today.', ' except in bed.',' but no one cared.',' but I am okay with that now.',', really.','...',' so, yeah...',' and you can probably see where this is going.',' but I don\'t believe a single word of it.',' and I\'m sure it\'ll happen one of these dips.',': ni ni ni ni ni chupacabra ping pong ball!',', it has been said.',', according to expert witnesses.', ', scientific studies have shown.',', statistically speaking.',', according to the latest word on the street.',' - in the minds of todip\'s youth.',' but I wouldn\'t worry about that.'];
redundancy.makeTransClause=function(){return make(redundancy.subjects)+' '+make(redundancy.transverbs)+' '+make(redundancy.objects);};
redundancy.makeIntransCluase=function(){return make(redundancy.subjects)+' '+make(redundancy.intransverbs);};
redundancy.makeCompoundClause=function(){return make(redundancy.interjections)+', '+make(redundancy.defclauses);};
redundancy.makeInterjected=function(){return make(redundancy.interjections)+', '+make(redundancy.defclauses);};
redundancy.defclauses=[
redundancy.makeTransClause,
redundancy.makeTransClause,
redundancy.makeTransClause,
function(){return redundancy.makeTransClause()+', and doesn\'t afraid of '+redundancy.makeObjNoun()},
function(){ return redundancy.makeTransClause()+' '+make(redundancy.comparison);},
redundancy.makeIntransCluase,
redundancy.makeIntransCluase,
function(){return make(redundancy.subjects)+' '+make(redundancy.linkingverbs)+' '+make(redundancy.adjective);},
function(){return make(redundancy.subjects)+' '+make(redundancy.linkingverbs)+' '+make(redundancy.objects);},
redundancy.makeCompoundClause,
redundancy.makeCompoundClause,
redundancy.makeInterjected,
redundancy.makeInterjected
];
redundancy.makeSubjNoun=function(){return make(redundancy.subjnouns);};
redundancy.subjects=[
function(){return make(redundancy.subjnouns)+' and '+make(redundancy.subjnouns);},
function(){return make(redundancy.subjnouns)+' '+make(redundancy.adjphrase);},
function(){return make(redundancy.subjnouns)+' '+make(redundancy.prepphrase);},
redundancy.makeSubjNoun,
redundancy.makeSubjNoun,
redundancy.makeSubjNoun,
redundancy.makeSubjNoun
];
redundancy.subjnouns=[
function(){return make(redundancy.department);},
function(){return make(redundancy.creature);},
function(){return make(redundancy.person);},
function(){return make(redundancy.thing);},
function(){return make(redundancy.character);}
];
redundancy.makeObjNoun=function(){return make(redundancy.objnouns);};
redundancy.objects=[
function(){return make(redundancy.objnouns)+' and '+make(redundancy.objnouns);},
function(){return make(redundancy.objnouns)+' '+make(redundancy.adjphrase);},
function(){return make(redundancy.objnouns)+' '+make(redundancy.prepphrase);},
redundancy.makeObjNoun,
redundancy.makeObjNoun,
redundancy.makeObjNoun,
redundancy.makeObjNoun,
'anything'
];
redundancy.objnouns=[
function(){return make(redundancy.department);},
function(){return make(redundancy.creature);},
function(){return make(redundancy.person);},
function(){return make(redundancy.thing);},
function(){return make(redundancy.character);}
];
redundancy.department=[
function(noart){return (noart?'':'the ')+'Department of Redundancy Department';},
function(noart){return (noart?'':'the ')+'Department';},
function(noart){return (noart?'':'the ')+make(redundancy.adjective)+' Department of Redundancy Department';},
function(noart){return (noart?'':'the ')+make(redundancy.adjective)+' Department';}
];
redundancy.makeAdjective=function(){return make(redundancy.adjectives);};
redundancy.makeModifiedAdjective=function(){return make(redundancy.adjmodifier)+ ' ' + make(redundancy.adjectives);};
redundancy.adjective=[
function(){return make(redundancy.adjective)+' but '+make(redundancy.adjective);},
function(){return make(redundancy.adjective)+' yet '+make(redundancy.adjective);},
redundancy.makeAdjective,
redundancy.makeAdjective,
redundancy.makeAdjective,
redundancy.makeAdjective,
redundancy.makeModifiedAdjective,
redundancy.makeModifiedAdjective,
redundancy.makeModifiedAdjective,
redundancy.makeModifiedAdjective,
function(){return make(redundancy.creature,1)+ '-like';},
function(){return make(redundancy.creature,1)+ 'ish';},
function(){return make(redundancy.adjmodifier)+ ' ' +make(redundancy.creature,1)+ '-like';},
function(){return make(redundancy.adjmodifier)+ ' ' +make(redundancy.creature,1)+ 'ish';}
]
redundancy.adjectives=['redundant','redundant','redundant','redundant','real','other','wrong','former','old','new','incredible','reliable','solid', 'cute','angry','squashed','wet','dry','spotted','striped','blue','green','brown','red','white','black','yellow','blood-soaked','clear','dirty','clean','shiny','late','blitzing','tired','formal','wonderful','overbearing','tacky','dead','deconstructed','cybernetic','boring','flammable','rotten','friendly','treeish','seaish','zanclean','riverish','steambottlish','weird','wingish','molpish','mustardy','chirping','bogus','ninjad','extreme','amazing','quick','diamond','ironic','golden','iron','chilled','delicious','stubborn','interesting','dedicated','tall','short','important','fast','prolific','loud','metal','awesomeful','<b>bold</b>','bald','hairy','modern','major','minor','great','radioactive','glowing','speakable','unspeakable','helpful','inevitable','sudden','problematic','active','retroactive','futuristic','retro','old-fashioned','polite','upper-class','rough','pythonic','industrial','achronal', 'plush'];
redundancy.adjmodifier=['very', 'somewhat','kinda','partly','not','nearly','almost','quite','not quite','almost but not quite entirely','entirely','fully','totally','a little bit','far too','incredibly','barely','most','least','hardly',
function(){return make(redundancy.adjective)+'ly';},
function(){return make(redundancy.prefix)+make(redundancy.adjective);}
];
redundancy.prefix=['un','non','in','anti','sub','super','post','pre','ex','in','redunda','pro','retro','counter','poly','pseudo'];
redundancy.conjunctions=[';','but','and','so','while','because','after','before','if','which is why','but then','yet','however','nevertheless','henceforth'];
redundancy.creature=[
function(noart){return (noart?'':'the ')+make(redundancy.creatures);},
function(noart){return (noart?'':'the ')+make(redundancy.adjectives)+' '+make(redundancy.creatures);}
];
redundancy.creatures=['molpy','molpy','molpy','redundakitty','kitty','badger','zombie','antelopey','badgermolp','bearraptor','beesnake','camolpy','centimolpy','chipmonpy','chirpy','chupamolpy','deerpy','dolphy','dragonflopy','ecolipy','facebug','flutterbee','foxmolpy','gatorraptor','geckolpy','guineamolp','hamply','kangamolp','keyboard','lizmolp','manapy','meowlpy','millimolpy','molpanzee','molpanda','molpbear','molpicoot','molephant','molmmoth','molmot','molpguin','molphish','molpidillo','molpouse','molpossum','molpy','molpybara','molpydile','molpyguana','molpymundi','molpysnake','moltise','monkeymolp','moopy','moosepy','murtle','neckpy','orcaraptor','owlpy','pricklymolp','quackmolpy','rabtor','raptor','raptorcat','raptorshark','ratpy','rhrinocerolpy','ribbit','sealpy','seawolpy','skunkpy','slothpy','sparrow-raptor','squirpy','viperraptor','trilobolpy','wallapy','waterottermolpy','wolpy','woolpy','wormolpy','zemolp', 'shork', 'blåhaj'];
redundancy.character=[
function(noart){return make(redundancy.characters);},
function(noart){return make(redundancy.adjectives)+' '+make(redundancy.characters);}
];
redundancy.characters=['Cueball','Megan','LaPetite','Bunny','Mini-Bunny','White Bunny','Gray Bun','Black Bun','Curly Bun','Pulled Back','Headband','Meg-a-like','Hat-Hair','Loopsy','Rose','Bob','Leopard','Sandy','She-Bangs','Littlest Bangs Brother','Middle Bangs Brother','Newest Bangs Brother','Sparse','Curly','Buzz','Brick','Forelock','Roundhair','Lopside','Shortdo','Shorty','Mini-Shortdo','Spike','Two-Tone','Mini-Two-Tone','Afro','Part','Baldo','Rosetta','B-1','B-2','B-3','Expando','GLaDOS','Cave Johnson'];
redundancy.interjections=['CH*RP','chirping mustard','ch*rping m*stard','m*stard','mustard','by GLR','oh','neat','neat','yeah','yeah','hey','no','yes','alright','nooooooooo','finally','chirp everything','ah','oooh','huh','hooray','what','well','welp'];
redundancy.makeSubPerson=function(){return make(redundancy.subspecifier)+' '+make(redundancy.group);};
redundancy.person=[
function(){return make(redundancy.people);}
];
redundancy.people=['the one who reads this','xe who is reading','the clicking person','whoever is on the outside of the screen looking in','one of your friends','a random OTTer','GLR','the stranger looking in the window','someone standing behind you','one of your parents','your mother','your long lost cousin from Australia','the Pope','the Mome','a Blitzer','an Old One','he','she','it','xe','a modern major general','Eternal Density','waveney','StormAngel','RAZOR',//this will not end well
redundancy.makeSubPerson,
redundancy.makeSubPerson,
redundancy.makeSubPerson,
redundancy.makeSubPerson,
redundancy.makeSubPerson,
redundancy.makeSubPerson,
redundancy.makeSubPerson,
redundancy.makeSubPerson,
redundancy.makeSubPerson,
redundancy.makeSubPerson
];
redundancy.subspecifier=[
function(){return 'the most '+make(redundancy.adjectives)+' '+make(redundancy.individual);},
function(){return 'the least '+make(redundancy.adjectives)+' '+make(redundancy.individual);}
];
redundancy.individual=['man','woman','child','person','being','OTTer','musician','writer','singer','coder','poster','quoter',
function(){return 'sentient '+make(redundancy.thing,1);}];
redundancy.group=['in the world','in the Mediterranean','on Mars','on the moon','in the future','of our time','since sliced bread','other than me','other than you','ever','in <SUBJECT HOMETOWN HERE>','since the Mayans','in the known world','in the internet','on the blogosphere','in the real world','(excluding Chuck Norris)','(even taking Leeroy Jenkins into consideration)','in the hidden cow level','in all of Minecraft','in this needle-pulled thing','made by Aperture Science','in the Enrichment Centre','according to the Guinness Book of Records','as stated in my recent Wikipedia edit','[citation needed]',
function(){return 'apart from '+make(redundancy.person);}];
redundancy.thing=[
function(noart){return (noart?'':make(redundancy.thingmods)+' ')+make(redundancy.things);},
function(noart){return (noart?'':make(redundancy.thingmods)+' ')+make(redundancy.adjectives)+' '+make(redundancy.things);}
];
redundancy.thingmods=['the', 'my', 'your'];
redundancy.things=['message','screen','tool','badge','boost','pointer','leopard','nothing','betrayal','food','fruit','planet','spaceship','firefly','amu<span class="faded">semen</span>t','forge','blackprint','crate','key','information','wisdom','bot','bacon','block','chip'];
redundancy.transverbs=[
function(){return make(redundancy.transverb);},
function(){return make(redundancy.adverb)+' '+make(redundancy.transverb);},
function(){return make(redundancy.transverbs)+', and '+make(redundancy.transverbs);},
function(){return make(redundancy.transverb)+' ('+make(redundancy.prepphrase)+')';}
];
redundancy.transverb=['kicks','clicks','requires','asks','requests','needs','sees','likes','destroys','drops','chases','eats','throws','burns','carries','fires','builds','destroys','quotes','wears','questions','chirps','decyphers','decodes','confuses','hates','expandifies','embiggens','molpifies','explains','redoes','hides','hugs','spoilers','separates','debugs','uploads','downloads','steals','climbs','produces','unbuckles','unties','unpacks','emails','decompiles','compiles','calls', function(){return 'is '+make(redundancy.things)+'ing'}];
redundancy.intransverbs=[
function(){return make(redundancy.intransverb);},
function(){return make(redundancy.adverb)+' '+make(redundancy.intransverb);},
function(){return make(redundancy.intransverbs)+', and '+make(redundancy.intransverbs);},
function(){return make(redundancy.intransverb)+' '+make(redundancy.comparison);},
function(){return make(redundancy.intransverb)+' '+make(redundancy.prepphrase);}
];
redundancy.intransverb=['jumps','laughs','burns','cries','explodes','melts','runs','sings','worries','dies','lives','decays','eats','plays','turns','spins','posts','burrows','types','reboots','refreshes','reloads','wonders','walks','falls','collapses','shrugs','departs', function(){return 'is '+make(redundancy.things)+'ing'}];
redundancy.prepphrase=[function(){return make(redundancy.prepositions)+' '+make(redundancy.objects);}];
redundancy.prepositions=['in','in','on','over','under','inside','outside','behind','from','within','from within','beside','underneath','near','at','for','into','of','in front of','nowhere near','to','from','close to','with','along','towards','away from','through','throughout','past','after','before'];
redundancy.adjphrase=[
function(){return make(redundancy.adjphrasestart)+' '+make(redundancy.transverbs)+' '+make(redundancy.objects);},
function(){return make(redundancy.adjphrasestart)+' '+make(redundancy.intransverbs);},
function(){return make(redundancy.adjphrasestart)+' '+make(redundancy.linkingverbs)+' '+make(redundancy.adjective);}
];
redundancy.adjphrasestart=['which','who'];
redundancy.makeAdverb=function(){return make(redundancy.adverbs);};
redundancy.adverb=[
redundancy.makeAdverb,
redundancy.makeAdverb,
redundancy.makeAdverb,
redundancy.makeAdverb,
function(){return make(redundancy.adjectives)+'ly';},
function(){return make(redundancy.adjectives)+'ishly';}
];
redundancy.comparison=[
function(){return 'like a '+make(redundancy.creature,1);},
function(){return 'like a '+make(redundancy.thing,1);},
function(){return 'like a '+make(redundancy.department,1);}
];
redundancy.adverbs=['kinda','almost','often','always','nearly','partly','never'];
redundancy.linkingverbs=['is','might be','will be', 'will have been', 'is going to be', 'is going to have been', 'could be', 'could have been','might be', 'might have been', 'should be', 'should have been', 'must be', 'must have been'];
redundancy.longsentence='The Department of Redundancy Department redundantly wishes to redundantly wish you (who are being redundantly wished by the Department of redundancy Department, redundantly) to be redundantly informed by the Department of Redundancy Department that the Department of Redundancy Department which is currently redundantly informing you has redundant information from the Department of Redundancy Department with which to redundantly inform you in order that you may be redundantly informed by the Department of Redundancy Department according to the redundant wishes of the Department of Redundancy Department which has that redundant information, at least according to other redundant information provided redundantly to you by the Department of Redundancy Department prior to the Department of Redundancy Department redundantly informing you with the redundant information with which it is currently redundantly informing you.';
return redundancy;
}
var red
var par = function(stuff) {
return '<p>' + stuff + '</p>';
}
var maketext = function() {
if(!red) red = MakeRedundancy();
g('redundantpar').className = 'partext';
var str = par(red.paragraph());
var i = 6;
while(i--)
str += '<br>' + par(red.paragraph());
g('redundantpar').innerHTML = str;
}
var eternalf = [];
var typocount = 0;
function format(gainned, level) {
if(Molpy.options.typo) return gainned;
var angle = gainned.indexOf('<');
var amper = gainned.indexOf('&');
if(angle == 0 || amper >= 0) return gainned; //don't mess with no html!
var squirpy = eternalf[gainned];
if(squirpy) return squirpy;
if(Math.abs(Molpy.newpixNumber) < typocount) return gainned;
level = level || 0;
var gained = gainned;
if(!flandom(1.005)) return gainned;
var n = flandom(angle > 0 ? (angle) : (gainned.length - 2));//irony: for a minute this wouldn't compile because I typo'd it as 'gained'
if(!isNaN(gainned[n])) return gainned;
gainned = gainned.slice(0, n + 1) + gainned.slice(n);
gainned = format(gainned, level + 1);
if(!level) {
typocount++;
if(typocount >= 1000) Molpy.EarnBadge('Typo Storm');
eternalf[gained] = gainned;
}
return gainned;
}
function EmergencyExport() {
var thread = '';
if(document.cookie.indexOf('CastleBuilderGame') >= 0) {
var k = ['', 0, 1, 2, 3, 4];
for( var i in k) {
var dough = document.cookie.split('CastleBuilderGame' + k[i] + '=')[1];
if(dough) thread += unescape(dough).split(';')[0] || '';
}
g('exporttext').value = thread;
g('export').className = 'unhidden';
g('otthercomic').className = 'hidden;'
}
}
function ShuffleList(l) {
for( var i in l) {
var j = flandom((parseInt(i) + 1));
var temp = l[j];
l[j] = l[i];
l[i] = temp;
}
}
function SplitWord(word) {
if(word.length <= 3) return [word];
if(word.length == 4) return [word.slice(0, 2), word.slice(2)];
var size = 2 + flandom(2);
return [word.slice(0, size)].concat(SplitWord(word.slice(size)));
}
function Wordify(words) {
words = words.split(' ');
var split = [];
for( var i in words) {
console.debug(words[i].length);
split = split.concat(SplitWord(words[i]));
}
console.debug(split.reduce(function(prev, next, i, a) {
return prev + ' ' + next;
}));
ShuffleList(split);
return split.reduce(function(prev, next, i, a) {
return prev + ' ' + next;
});
}
function plural(n,p) {
return n == 1 ? '' : p||'s';
}