Created
June 12, 2012 10:53
-
-
Save Chris927/2916866 to your computer and use it in GitHub Desktop.
fun exercise around aunt Lily and her cats...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* fun exercise around aunt Lily and her cats... */ | |
| (function (owner) { | |
| function randomInt(i) { | |
| return Math.floor(Math.random() * i); | |
| } | |
| function randomText() { | |
| var texts = [ | |
| "Dear nephew,\n\nI. Mrs Hubble tersely solved it up, may not being common, \nand rubbing his jaws -- as if it was the wall to the front premises.\n I turned to take the floors of the ironed leg of myself, from which fall to me away now, \nopening the brewery, was very curious manner in the lower bars with your mother? `There, sir!\n said Miss Havisham beckoned her too, lying smoking his blood-stained \nsword in passing the table-cloth, with her eyes restlessly about in the looking-glass. It was haunted by \ncollision with an overgrown with a dyke came, without being always wore.\n", | |
| "Dear nephew,\n\nNot a word after offering his slice, to dine with very smallest scale. \nOne night, for anything, for the boy! exclaimed my men went there was to be changed, and never grateful? I was just a Sunday with her foot. \n`Tell us to be a profound conviction that Mr Wopales great- aunts granddaughter; I asked, in that: so, and twisting them out. Thats my babyhood, a most oncommon ones -- \nwhich ensued upon the stones dropped into our slices served as from Mr Wopales great-aunt collected a dressing-room, as rather more to say, Pip; stay a pr-r-recious pair.\n", | |
| "Dear nephew,\n\n`Glasses round! `This is no Tickler with the rank wet flat. \n`I sometimes a bright suggestion that Joes job done. This mental exercise to Joe. `Christened Pip ? `And eight?\nmeaning to nine, and work at me on the family. \nNeither, were both to do, old rag tied over him while they were that impelled me to be more of my grasp and he \nlooked when I have made me -- go wrong in a nutmeg-grater \ninstead of the tea-things, Joe and other times, which we was, to slip off. Instantly afterwards, as I could hold of a master-mind.\n", | |
| "Dear nephew,\n\n`Whats that? I considered how small errand, almost always wore this\n Educational scheme or had been walled up; thats further investigation. She rented a pitcher of the back was agreeable, and Mrs Joe,\n with both to be able to the footing bad, darkness coming back. Now that her little greasy \nmemorandum-book kept in my ears, it was. I got any life.\n Joes curiosity by the poker again; without making the young, under suspicion \nalonger your sister liberal. She won them when three fardens, for I morbidly represented to restore \nthem out this to say, `You was not have been faltered.\n", | |
| "Dear nephew,\n\nMuch of being ashamed of their muskets and without, under it down, \nand the case, for the young, under the little food I religiously entertained that everything that I was \nvery odd idea that we all I had been the bellows, the tambourine upon the \ntwo thousand years, and with a thing I was perfectly frantic -- his eyes restlessly \nabout at a person took the murky shadows on tight, while he rubbed, first most curious manner \nas a press in his shirt sleeve over him; and limping to see her fair \nman, after some butter off last night?.\n", | |
| "Dear nephew,\n\nopposition to skin that Mr Pumblechook and so much upon her; \naltogether, and we all my mouth like a meat without finding an alphabet \non the veal-cutlets. `If you have been within eight oclock came back, \nand hold me; `so youre kindly let us and awaited my sister went straight on the river-side, on them a habit to Mr Wopsle, \nnext to try to speak (I didnt quite desperate, so pretty? `I am indebted for the truth, hardly knew to transact \nhis brandy from the subject still going; but now with the neck of his \nhead bending over his nose bells were your elths your sister, casting me as I rise?.\n", | |
| "Dear nephew,\n\nThat was livid to be grateful this time at me. I misdealt, as he nodded to be \neverywhere. For, there warnt for me. I hope that he could dissociate them up with? `Well, said my all-powerful sister, Mrs Joe. \n`You have put my little on the old chap, said Joe, when she was an invisible to drive all at that few minutes by several \ntimes nine, boy? `We dont want no more, so as bad judge) agreed, and thats further away, and trimmings on Saturday nights, which ensued upon snow.\n", | |
| "Dear nephew,\n\nEnough of getting at yesterdays meat or large, and when Joe imparted \na sick fancies, she has he? cried Joe, sitting alone in it was brought you, Pip. So, I was absent, \nand have it. `Thankee, my way pecooliar to be dried at him steady, men! and the \nlarge dog of my bread-and-butter down at him the pot a long chain were also dead and had your elth. \nBy the Dutch clock, `shes been there were wanted mending and par- \nticular reason why she was so aggravated me, Joe, said Joe. `Not that grip, that we are! Now, I believe \nthat I see what a dozen times, looking for me.\n" | |
| ]; | |
| var which = randomInt(texts.length); | |
| return texts[which]; | |
| } | |
| var liveCats = {}; | |
| var names = [ "Clayton Mcguinn", "Milagros Lok", "Neva Hamed", "Darren Szeto", "Mooring", "Jamie Baumeister", "Julio Arab", "Darryl Westberry", "Penelope Tezeno", "Emilia Madruga", "Margery Stickley", "Fernando Cashin", "Javier Montesino", "Emilia Geske", "Eve Weick", "Loraine Sevin", "Benita Shrock", "Mathew Weatherall", "Tameka Lenihan", "Esmeralda Mohney", "Clayton Holtzen", "Clayton Jeske", "Emilia Jennette", "Jamie Rys", "Serena Topete", "Darryl Holzinger", "Guy Breuer", "Amie Plain", "Marylou Philipp", "Selena Gilbo" ]; | |
| liveCats[names] = names[randomInt(names.length)]; | |
| liveCats.count = 1; | |
| function determineCatsToDie(liveCats) { | |
| if (liveCats.count < 2) { | |
| return []; | |
| } | |
| return [ names[randomInt(names.length)] ]; | |
| } | |
| function determineCatsToBeBorn(liveCats, names) { | |
| var ix = randomInt(names.length - 1); | |
| return [ names[ix], names[ix + 1] ]; | |
| } | |
| owner.retrieveMailsFromAunt = function() { | |
| var texts = []; | |
| for (var i = 0; i < 20; i++) { | |
| var catsToDie = determineCatsToDie(liveCats); | |
| var catsToBeBorn = determineCatsToBeBorn(liveCats, names); | |
| var text = randomText(); | |
| text += "\nborn: "; | |
| for (var j = 0; j < catsToBeBorn.length; j++) { | |
| if (j > 0) { | |
| text += ", "; | |
| } | |
| text += catsToBeBorn[j]; | |
| liveCats[catsToBeBorn[j]] = true; | |
| liveCats.count += 1; | |
| } | |
| text += "\n"; | |
| for (var j = 0; j < catsToDie.length; j++) { | |
| text += "died: " + catsToDie[j] + "\n"; | |
| } | |
| text += "\nYours truly,\nAunt Lily"; | |
| texts.push(text); | |
| } | |
| return texts; | |
| } | |
| }) (window); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment