diff --git a/game.js b/game.js index 01246a4..fa92d86 100644 --- a/game.js +++ b/game.js @@ -9,6 +9,8 @@ var maxBowelsDigest = 10; var metric = true; +var verbose = true; + victims = {}; function toggle_auto() @@ -30,6 +32,13 @@ function toggle_units() update(); } +function toggle_verbose() +{ + verbose = !verbose; + + document.getElementById("button-verbose").innerHTML = verbose ? "Verbose" : "Simple"; +} + function initVictims() { return { @@ -114,7 +123,7 @@ function feed() { var prey = getPrey("suburb", 0.5*scale*scale); - var line = prey.eat() + " " + summarize(prey.sum(), false); + var line = prey.eat(verbose) + " " + summarize(prey.sum(), false); var preyMass = prey.sum_property("mass"); @@ -132,7 +141,7 @@ function feed() function stomp() { var prey = getPrey("suburb", 1.5*scale*scale); - var line = prey.stomp() + " " + summarize(prey.sum(), true); + var line = prey.stomp(verbose) + " " + summarize(prey.sum(), true); var preyMass = prey.sum_property("mass"); @@ -146,8 +155,8 @@ function anal_vore() { var prey = getOnePrey(0.25*scale*scale); var crushed = getPrey("suburb",3*scale*scale); - var line1 = prey.anal_vore(baseHeight*scale) + " " + summarize(prey.sum(), false); - var line2 = crushed.buttcrush() + " " + summarize(crushed.sum(), true) + var line1 = prey.anal_vore(verbose, baseHeight*scale) + " " + summarize(prey.sum(), false); + var line2 = crushed.buttcrush(verbose) + " " + summarize(crushed.sum(), true) var preyMass = prey.sum_property("mass"); var crushedMass = prey.sum_property("mass"); @@ -284,6 +293,7 @@ window.addEventListener('load', function(event) { document.getElementById("button-anal_vore").addEventListener("click",anal_vore); document.getElementById("button-stroll").addEventListener("click",toggle_auto); document.getElementById("button-units").addEventListener("click",toggle_units); + document.getElementById("button-verbose").addEventListener("click",toggle_verbose); setTimeout(pick_move, 2000); update(); diff --git a/recursive-macro.js b/recursive-macro.js index e7dde4c..93af067 100644 --- a/recursive-macro.js +++ b/recursive-macro.js @@ -1,4 +1,3 @@ - var things = { "Container": Container, @@ -226,23 +225,23 @@ function distribution(min, max, samples) { /* default actions */ function defaultStomp(thing) { - return function (height=10) { return "You crush " + thing.describe() + " underfoot."}; + return function (verbose=true,height=10) { return "You crush " + thing.describe(verbose) + " underfoot."}; } function defaultKick(thing) { - return function(height=10) { return "You punt " + thing.describe() + ", destroying " + (thing.count > 1 ? "them" : "it") + "."; } + return function(verbose=true,height=10) { return "You punt " + thing.describe(verbose) + ", destroying " + (thing.count > 1 ? "them" : "it") + "."; } } function defaultEat(thing) { - return function(height=10) { return "You scoop up " + thing.describe() + " and swallow " + (thing.count > 1 ? "them" : "it") + " whole."; } + return function(verbose=true,height=10) { return "You scoop up " + thing.describe(verbose) + " and swallow " + (thing.count > 1 ? "them" : "it") + " whole."; } } function defaultAnalVore(thing) { - return function(height=10) { return "You sit yourself down on " + thing.describe() + ". " + (thing.count > 1 ? "They slide" : "It slides") + " inside with ease."; } + return function(verbose=true,height=10) { return "You sit yourself down on " + thing.describe(verbose) + ". " + (thing.count > 1 ? "They slide" : "It slides") + " inside with ease."; } } function defaultButtcrush(thing) { - return function(height=10) { return "Your heavy ass obliterates " + thing.describe() + ". "; } + return function(verbose=true,height=10) { return "Your heavy ass obliterates " + thing.describe(verbose) + ". "; } } function defaultArea(thing) { @@ -363,7 +362,7 @@ function Container(contents = []) { } this.describe = function(verbose = true) { - return describe_all(this.contents,false) + return describe_all(this.contents,verbose) } this.eat = function() { @@ -405,7 +404,7 @@ function Person(count = 1) { return this.count + " people" } } else { - return this.count + " " + (this.count > 1 ? "people" : "person"); + return (this.count > 1 ? this.count + " people" : "a person"); } } @@ -457,7 +456,7 @@ function EmptyCar(count = 1) { return this.count + " parked cars"; } } else { - return this.count + " parked " + (this.count > 1 ? "cars" : "car"); + return (this.count > 1 ? this.count + " parked cars" : "a parked car"); } } @@ -492,7 +491,7 @@ function Car(count = 1) { return this.count + " cars with " + this.contents.person.describe(false) + " inside"; } } else { - return this.count + " " + (this.count > 1 ? "cars" : "car"); + return (this.count > 1 ? this.count + " cars" : "a car"); } } @@ -516,15 +515,20 @@ function Bus(count = 1) { } this.describe = function(verbose = true) { - if (this.count <= 3) { - list = []; - for (var i = 0; i < this.count; i++) { - list.push(this.describeOne(this.count < 2)); + if (verbose) { + if (this.count <= 3) { + list = []; + for (var i = 0; i < this.count; i++) { + list.push(this.describeOne(this.count < 2)); + } + return merge_things(list) + " with " + this.contents.person.describe() + " inside"; + } else { + return this.count + " buses with " + this.contents.person.describe() + " inside"; } - return merge_things(list) + " with " + this.contents.person.describe() + " inside"; } else { - return this.count + " buses with " + this.contents.person.describe() + " inside"; + return (this.count > 1 ? this.count + " buses" : "a bus"); } + } } @@ -546,14 +550,18 @@ function Tram(count = 1) { } this.describe = function(verbose = true) { - if (this.count <= 3) { - list = []; - for (var i = 0; i < this.count; i++) { - list.push(this.describeOne(this.count < 2)); + if (verbose) { + if (this.count <= 3) { + list = []; + for (var i = 0; i < this.count; i++) { + list.push(this.describeOne(this.count < 2)); + } + return merge_things(list) + " with " + this.contents.person.describe() + " inside"; + } else { + return this.count + " trams with " + this.contents.person.describe() + " inside"; } - return merge_things(list) + " with " + this.contents.person.describe() + " inside"; } else { - return this.count + " trams with " + this.contents.person.describe() + " inside"; + return (this.count > 1 ? this.count + " trams" : "a tram"); } } @@ -570,9 +578,6 @@ function Motorcycle(count = 1) { this.count = count; this.contents = {}; - - - var amount = distribution(1,2,count); this.contents.person = new Person(amount); } @@ -590,7 +595,6 @@ function Train(count = 1) { amount = distribution(1,10,count); this.contents.traincar = new TrainCar(amount); - this.describeOne = function(verbose=true) { adjective = random_desc(["rusty","brand-new"], (verbose ? 0.3 : 0)); color = random_desc(["black","tan","gray"], (verbose ? 1 : 0)); @@ -599,15 +603,20 @@ function Train(count = 1) { } this.describe = function(verbose = true) { - if (this.count <= 3) { - list = []; - for (var i = 0; i < this.count; i++) { - list.push(this.describeOne(this.count < 2)); + if (verbose) { + if (this.count <= 3) { + list = []; + for (var i = 0; i < this.count; i++) { + list.push(this.describeOne(this.count < 2)); + } + return merge_things(list) + " with " + this.contents.person.describe() + " in the engine and " + this.contents.traincar.describe() + " attached"; + } else { + return this.count + " trains with " + this.contents.person.describe() + " in the engine and " + this.contents.traincar.describe() + " attached"; } - return merge_things(list) + " with " + this.contents.person.describe() + " in the engine and " + this.contents.traincar.describe() + " attached"; } else { - return this.count + " trains with " + this.contents.person.describe() + " in the engine and " + this.contents.traincar.describe() + " attached"; + return (this.count > 1 ? this.count + " trains" : "a train"); } + } this.anal_vore = function() { @@ -634,14 +643,18 @@ function TrainCar(count = 1) { } this.describe = function(verbose = true) { - if (this.count <= 3) { - list = []; - for (var i = 0; i < this.count; i++) { - list.push(this.describeOne(this.count < 2)); + if (verbose) { + if (this.count <= 3) { + list = []; + for (var i = 0; i < this.count; i++) { + list.push(this.describeOne(this.count < 2)); + } + return merge_things(list) + " with " + describe_all(this.contents) + " inside"; + } else { + return this.count + " train cars with " + describe_all(this.contents) + " inside"; } - return merge_things(list) + " with " + describe_all(this.contents) + " inside"; } else { - return this.count + " train cars with " + describe_all(this.contents) + " inside"; + return (this.count > 1 ? this.count + " train cars" : "a train car"); } } } @@ -665,14 +678,18 @@ function House(count = 1) { } this.describe = function(verbose = true) { - if (this.count <= 3) { - list = []; - for (var i = 0; i < this.count; i++) { - list.push(this.describeOne(this.count < 2)); + if (verbose) { + if (this.count <= 3) { + list = []; + for (var i = 0; i < this.count; i++) { + list.push(this.describeOne(this.count < 2)); + } + return merge_things(list) + " with " + this.contents.person.describe(verbose) + " inside"; + } else { + return this.count + " homes with " + this.contents.person.describe(verbose) + " inside"; } - return merge_things(list) + " with " + this.contents.person.describe() + " inside"; } else { - return this.count + " homes with " + this.contents.person.describe() + " inside"; + return (this.count > 1 ? this.count + " houses" : "a house"); } } } @@ -695,15 +712,20 @@ function SmallSkyscraper(count = 1) { } this.describe = function(verbose = true) { - if (this.count <= 3) { - list = []; - for (var i = 0; i < this.count; i++) { - list.push(this.describeOne(this.count < 2)); + if (verbose) { + if (this.count <= 3) { + list = []; + for (var i = 0; i < this.count; i++) { + list.push(this.describeOne(this.count < 2)); + } + return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside"; + } else { + return this.count + " small skyscrapers with " + describe_all(this.contents,verbose) + " inside"; } - return merge_things(list) + " with " + describe_all(this.contents,false) + " inside"; } else { - return this.count + " small skyscrapers with " + describe_all(this.contents,false) + " inside"; + return (this.count > 1 ? this.count + " skyscrapers" : "a skyscraper"); } + } this.anal_vore = function(height=10) { @@ -733,7 +755,11 @@ function ParkingGarage(count = 1) { } this.describe = function(verbose = true) { - return (this.count == 1 ? "a parking garage" : this.count + " parking garages") + " with " + describe_all(this.contents) + " inside"; + if (verbose) { + return (this.count == 1 ? "a parking garage" : this.count + " parking garages") + " with " + describe_all(this.contents, verbose) + " inside"; + } else { + return (this.count == 1 ? "a parking garage" : this.count + " parking garages"); + } } } diff --git a/stroll.html b/stroll.html index 5641afe..0e63a70 100644 --- a/stroll.html +++ b/stroll.html @@ -17,7 +17,7 @@
-
Welcome to Stroll 0.1.3
+
Welcome to Stroll 0.1.4
It's a nice day for a walk
@@ -28,6 +28,7 @@
Standing
+

Stomped