From 54e052d6f29756ba2ee94c31b85fd49e30e335a0 Mon Sep 17 00:00:00 2001 From: Jules Date: Tue, 25 Oct 2016 21:02:46 -0400 Subject: buttons for other courses --- README | 2 +- data/cereal.txt | 23 ++++++++++++++- data/diseases.txt | 18 +++++++++++- data/drugs.txt | 38 +++++++++++++++++++++++- data/elements.txt | 73 +++++++++++++++++++++++++++++++++++++++++++++- data/insects.txt | 29 +++++++++++++++++- data/preparations.txt | 0 data/products.dairy.txt | 0 data/products.default.txt | 0 data/products.esoteric.txt | 2 +- data/products.meat.txt | 0 data/products.seafood.txt | 0 data/religions.txt | 40 ++++++++++++++++++++++++- data/sf.txt | 22 +++++++++++++- data/techniques.txt | 0 index.html | 62 +++++++++++++++++++++++++++++++++++++-- js/app.js | 33 ++++++++++++++++++--- js/course.js | 10 ++++--- js/flatfile.js | 2 +- js/jquery-2.0.3.min.js | 0 js/loader.js | 3 ++ js/util.js | 0 22 files changed, 337 insertions(+), 20 deletions(-) mode change 100644 => 100755 README mode change 100644 => 100755 data/cereal.txt mode change 100644 => 100755 data/diseases.txt mode change 100644 => 100755 data/drugs.txt mode change 100644 => 100755 data/elements.txt mode change 100644 => 100755 data/insects.txt mode change 100644 => 100755 data/preparations.txt mode change 100644 => 100755 data/products.dairy.txt mode change 100644 => 100755 data/products.default.txt mode change 100644 => 100755 data/products.esoteric.txt mode change 100644 => 100755 data/products.meat.txt mode change 100644 => 100755 data/products.seafood.txt mode change 100644 => 100755 data/religions.txt mode change 100644 => 100755 data/sf.txt mode change 100644 => 100755 data/techniques.txt mode change 100644 => 100755 index.html mode change 100644 => 100755 js/app.js mode change 100644 => 100755 js/course.js mode change 100644 => 100755 js/flatfile.js mode change 100644 => 100755 js/jquery-2.0.3.min.js mode change 100644 => 100755 js/loader.js mode change 100644 => 100755 js/util.js diff --git a/README b/README old mode 100644 new mode 100755 index 0faa7dc..044fc69 --- a/README +++ b/README @@ -3,7 +3,7 @@ delicious corpse Exquisite corpse style pairing game. -http://asdf.us/dc/ +http://asdf.us/corpse/ Original version 2006 Javascript port 2013 diff --git a/data/cereal.txt b/data/cereal.txt old mode 100644 new mode 100755 index 0f7fbdb..0d53a4b --- a/data/cereal.txt +++ b/data/cereal.txt @@ -1 +1,22 @@ -boo berry, cap'n crunch, cheerio, cinnamon toast crunch, cocoa krispy, cookie crisp, corn pop, count chocola, crispy critter, frankenberry, frosted flake, fruit loop, fruity pebble, honey nut cheerio, honeycomb, life, lucky charm, rice krispy, sugar crisp, sugar smack, trix, weetabix +boo berry +cap'n crunch +cheerio +cinnamon toast crunch +cocoa krispy +cookie crisp +corn pop +count chocola +crispy critter +frankenberry +frosted flake +fruit loop +fruity pebble +honey nut cheerio +honeycomb +life +lucky charm +rice krispy +sugar crisp +sugar smack +trix +weetabix diff --git a/data/diseases.txt b/data/diseases.txt old mode 100644 new mode 100755 index 0fa0180..314ebdf --- a/data/diseases.txt +++ b/data/diseases.txt @@ -1 +1,17 @@ -eczema, herpes, aids, ebola, cancer, rickets, scurvy, diabetes, emphysema, syphilis, gonnorhea, gout, polio, influenza, hodgkin's, lupus, parkinson's +eczema +herpes +aids +ebola +cancer +rickets +scurvy +diabetes +emphysema +syphilis +gonnorhea +gout +polio +influenza +hodgkin's +lupus +parkinson's diff --git a/data/drugs.txt b/data/drugs.txt old mode 100644 new mode 100755 index 7ce7542..591c1c3 --- a/data/drugs.txt +++ b/data/drugs.txt @@ -1 +1,37 @@ -2-cb, 2-ci, 2-ct-7, 5-MeO-DMT, amyl nitrate, angel dust, ayahuasca, black lotus, cocaine, crack, dmt, dxm, ecstasy, ganja, ghb, hashish, heroin, ibogaine, ketamine, lsd, marijuana, mda, mdma, mescaline, meth, nitrous oxide, opium, oxycontin, pcp, peyote, salvia, shroom, speed, thujone, toad venom, tonka bean, wormwood +2-cb +2-ci +2-ct-7 +5-MeO-DMT +amyl nitrate +angel dust +ayahuasca +black lotus +cocaine +crack +dmt +dxm +ecstasy +ganja +ghb +hashish +heroin +ibogaine +ketamine +lsd +marijuana +mda +mdma +mescaline +meth +nitrous oxide +opium +oxycontin +pcp +peyote +salvia +shroom +speed +thujone +toad venom +tonka bean +wormwood diff --git a/data/elements.txt b/data/elements.txt old mode 100644 new mode 100755 index 5044ae8..402fc39 --- a/data/elements.txt +++ b/data/elements.txt @@ -1,2 +1,73 @@ -actinum, aluminium, antimony, argon, arsenic, astatine, barium, beryllium, bismuth, bohrium, boron, bromine, cadmium, calcium, carbon, cesium, chlorine, chromium, cobalt, copper, flourine, francium, gallium, germanium, gold, helium, hydrogen, iodine, iridium, iron, krypton, lanthanum, lead, lithium, magnesium, manganese, mercury, molybdenum, neon, nickel, niobium, nitrogen, osmium, oxygen, palladium, phosphorus, platinum, polonium, potassium, radium, radon, rhenium, rhodium, rutherfordium, scandium, selenium, silicon, silver, sodium, strontium, sulphur, tellurium, thallium, tin, titanium, tungsten, unununium, vanadium, xenon, yttrium, zinc, zirconium +actinum +aluminium +antimony +argon +arsenic +astatine +barium +beryllium +bismuth +bohrium +boron +bromine +cadmium +calcium +carbon +cesium +chlorine +chromium +cobalt +copper +flourine +francium +gallium +germanium +gold +helium +hydrogen +iodine +iridium +iron +krypton +lanthanum +lead +lithium +magnesium +manganese +mercury +molybdenum +neon +nickel +niobium +nitrogen +osmium +oxygen +palladium +phosphorus +platinum +polonium +potassium +radium +radon +rhenium +rhodium +rutherfordium +scandium +selenium +silicon +silver +sodium +strontium +sulphur +tellurium +thallium +tin +titanium +tungsten +unununium +vanadium +xenon +yttrium +zinc +zirconium diff --git a/data/insects.txt b/data/insects.txt old mode 100644 new mode 100755 index 33584e0..ca811c9 --- a/data/insects.txt +++ b/data/insects.txt @@ -1,2 +1,29 @@ -ant, aphid, bee, beetle, butterfly, cicada, cockroach, cricket, cricket, dung beetle, earthworm, fly, fruit fly, grub, hornet, ladybug, larva, mealworm, moth, praying mantis, scorpion, sea worm, silkworm, spider, tarantula, termite, tick, wasp +ant +aphid +bee +beetle +butterfly +cicada +cockroach +cricket +cricket +dung beetle +earthworm +fly +fruit fly +grub +hornet +ladybug +larva +mealworm +moth +praying mantis +scorpion +sea worm +silkworm +spider +tarantula +termite +tick +wasp diff --git a/data/preparations.txt b/data/preparations.txt old mode 100644 new mode 100755 diff --git a/data/products.dairy.txt b/data/products.dairy.txt old mode 100644 new mode 100755 diff --git a/data/products.default.txt b/data/products.default.txt old mode 100644 new mode 100755 diff --git a/data/products.esoteric.txt b/data/products.esoteric.txt old mode 100644 new mode 100755 index ae30221..4dde54f --- a/data/products.esoteric.txt +++ b/data/products.esoteric.txt @@ -1,4 +1,4 @@ -absinth +absinthe acorn alfalfa alligator diff --git a/data/products.meat.txt b/data/products.meat.txt old mode 100644 new mode 100755 diff --git a/data/products.seafood.txt b/data/products.seafood.txt old mode 100644 new mode 100755 diff --git a/data/religions.txt b/data/religions.txt old mode 100644 new mode 100755 index dc9f014..cfd1d29 --- a/data/religions.txt +++ b/data/religions.txt @@ -1 +1,39 @@ -agnostic, anglican, atheist, atheist, baha'i, baptist, born-again christian, buddhist, calvinist, christian scientist, congregationalist, cult, deist, eastern orthodox, episcopalian, greek orthodox, hindu, jehovah's witness, jewish, lutheran, methodist, moonie, mormon, muslim, presbyterian, quaker, rastafarian, roman catholic, russian orthodox, satanist, scientologist, shia, sikh, sunni, tribalist, unitarian, wiccan, zen, zoroastrian +agnostic +anglican +atheist +atheist +baha'i +baptist +born-again christian +buddhist +calvinist +christian scientist +congregationalist +cult +deist +eastern orthodox +episcopalian +greek orthodox +hindu +jehovah's witness +jewish +lutheran +methodist +moonie +mormon +muslim +presbyterian +quaker +rastafarian +roman catholic +russian orthodox +satanist +scientologist +shia +sikh +sunni +tribalist +unitarian +wiccan +zen +zoroastrian diff --git a/data/sf.txt b/data/sf.txt old mode 100644 new mode 100755 index c8b5b01..e4796c4 --- a/data/sf.txt +++ b/data/sf.txt @@ -1 +1,21 @@ -mission, bernal heights, noe valley, castro, tenderloin, chinatown, sunset, richmond, bayview, excelsior, potrero hill, nob hill, civic center, soma, marina, pacific heights, twin peaks, embarcadero, north beach, haight, hayes valley +mission +bernal heights +noe valley +castro +tenderloin +chinatown +sunset +richmond +bayview +excelsior +potrero hill +nob hill +civic center +soma +marina +pacific heights +twin peaks +embarcadero +north beach +haight +hayes valley diff --git a/data/techniques.txt b/data/techniques.txt old mode 100644 new mode 100755 diff --git a/index.html b/index.html old mode 100644 new mode 100755 index 3b5e456..e65baa7 --- a/index.html +++ b/index.html @@ -3,12 +3,70 @@ Delicious Corpse - -
+
+

~ delicious corpse ~

+

HERE IS YOUR RANDOMLY GENERATED MENU

+

PICK YOUR FAVORITE COURSES

+ +
+
+ ~ or pick your favorite shopping list ~
+ + +
+ + + + +
+ + + + + +
+
diff --git a/js/app.js b/js/app.js old mode 100644 new mode 100755 index 847b9a7..fa2711e --- a/js/app.js +++ b/js/app.js @@ -1,5 +1,6 @@ var config = {}; config.images = []; +window.mode = 'omnivore' function app(){}; app.init = function(){ @@ -15,9 +16,15 @@ app.load = function(){ , new Flatfile ("esoteric", "products.esoteric.txt") , new Flatfile ("meat", "products.meat.txt") , new Flatfile ("seafood", "products.seafood.txt") - , new Flatfile ("weird", "products.esoteric.txt") , new Flatfile ("techniques", "techniques.txt") , new Flatfile ("preparations", "preparations.txt") + , new Flatfile ("cereal", "cereal.txt") + , new Flatfile ("diseases", "diseases.txt") + , new Flatfile ("drugs", "drugs.txt") + , new Flatfile ("elements", "elements.txt") + , new Flatfile ("insects", "insects.txt") + , new Flatfile ("sf", "sf.txt") + , new Flatfile ("religions", "religions.txt") ]; app.loader.ready("loading"); @@ -31,20 +38,38 @@ app.ready = function(){ app.bind = function(){ $("#generate").click(app.generate); + $(".switch").click(app.switch_mode); +} + +app.switch_mode = function(){ + window.mode = $(this).html() + $('.active').removeClass('active') + $(this).addClass('active') + app.generate() } app.generate = function(){ - window.products = [].concat(vegan,meat,dairy,seafood); + if (mode == 'omnivore') { + window.products = [].concat(vegan,meat,dairy,seafood); + } else if (mode == 'vegan') { + window.products = [].concat(vegan); + } else if (mode == 'weirdo') { + window.products = [].concat(vegan,meat,dairy,seafood,esoteric); + } else { + window.products = [].concat(window[mode]) + } +console.log(window.products) var texts = []; for (var i = 0; i < courses.length; i++) { var courseName = courses[i][0]; var text = "

" + courseName + "

"; + var course = [] for (var j = 1; j < courses[i].length; j++) { - text += "

" + course(courses[i][j]) + "

"; + course.push( dish(courses[i][j]) ) } + text += "

" + course.join(", ") + "

" texts.push(text); } - console.log(texts) $("#result").html(texts.join("")); } diff --git a/js/course.js b/js/course.js old mode 100644 new mode 100755 index 2924eb6..2a35719 --- a/js/course.js +++ b/js/course.js @@ -14,11 +14,11 @@ function course(n) { var ds = [ dish() ]; return ds.join(", "); } -function dish(){ - var pcount = rand(3) + 1; +function dish(n){ + var pcount = n || rand(2) + 1; var ps = []; while (pcount-- > 0) ps.push(product()); - if (rand(100) > 60) { + if (rand(100) < 90) { var d = ps.join(" and ") + " " + choice(preparations); } else { @@ -28,7 +28,7 @@ function dish(){ } function product(){ var result; - if (rand(100) > 90) { + if (rand(100) > 1) { var technique = choice(techniques); if (technique[0] == '-') { result = choice(products) + technique + " " + choice(products); @@ -36,9 +36,11 @@ function product(){ result = technique + " " + choice(products) } } +/* else if (rand(100) > 0) { result = choice(products) + " " + choice(products) } +*/ else { result = choice(products) } diff --git a/js/flatfile.js b/js/flatfile.js old mode 100644 new mode 100755 index 1b6b132..89a6b17 --- a/js/flatfile.js +++ b/js/flatfile.js @@ -7,7 +7,7 @@ Flatfile.prototype.load = function(){ var _this = this; app.loader.register(this.key); $.get("data/" + this.filename, function(data) { - window[_this.key] = data.split("\n"); + window[_this.key] = data.split("\n").filter(function(a){ return a && a.length > 0 }); app.loader.ready(_this.key); }) } \ No newline at end of file diff --git a/js/jquery-2.0.3.min.js b/js/jquery-2.0.3.min.js old mode 100644 new mode 100755 diff --git a/js/loader.js b/js/loader.js old mode 100644 new mode 100755 index ddf4b7e..90f04c7 --- a/js/loader.js +++ b/js/loader.js @@ -21,6 +21,9 @@ app.load = function(){ } app.ready = function(){ } +// so basically he also puts a bunch of variables in the global namespace. Does that seem +// contradictory to an OOP approach? in global namespace where will be only app variable. no there are also +// ******************************************************/ function Loader (readyCallback){ diff --git a/js/util.js b/js/util.js old mode 100644 new mode 100755 -- cgit v1.2.3-70-g09d2