소스 검색

Added a simple mode to reduce clutter

tags/v0.7.0
Fen Dweller 7 년 전
부모
커밋
d3b03c7b88
3개의 변경된 파일93개의 추가작업 그리고 56개의 파일을 삭제
  1. +14
    -4
      game.js
  2. +77
    -51
      recursive-macro.js
  3. +2
    -1
      stroll.html

+ 14
- 4
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();


+ 77
- 51
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");
}
}
}



+ 2
- 1
stroll.html 파일 보기

@@ -17,7 +17,7 @@
</div>
<div id=game-area>
<div id=log>
<div>Welcome to Stroll 0.1.3</div>
<div>Welcome to Stroll 0.1.4</div>
<div>It's a nice day for a walk</div>
</div>
<button id=button-grow>Get Bigger</button>
@@ -28,6 +28,7 @@
<button id=button-stroll>Stroll</button>
<div id=strolling-indicator>Standing</div>
<button id=button-units>Metric</button>
<button id=button-verbose>Verbose</button>
<div class=flex-container>
<div class=stat-header id=stats-stomped>
<p>Stomped</p>


불러오는 중...
취소
저장