big steppy
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 

1294 Zeilen
34 KiB

  1. 'use strict';
  2. var things =
  3. {
  4. "Container": Container,
  5. "Person": Person,
  6. "Human": Human,
  7. "Cow": Cow,
  8. "Empty Car": EmptyCar,
  9. "Car": Car,
  10. "Bus": Bus,
  11. "Tram": Tram,
  12. "House": House,
  13. "Barn": Barn,
  14. "Small Skyscraper": SmallSkyscraper,
  15. "Large Skyscraper": LargeSkyscraper,
  16. "Train": Train,
  17. "Train Car": TrainCar,
  18. "Parking Garage": ParkingGarage,
  19. "Town": Town,
  20. "City": City,
  21. "Continent": Continent,
  22. "Planet": Planet,
  23. "Star": Star,
  24. "Solar System": SolarSystem,
  25. "Galaxy": Galaxy,
  26. "Cluster": Cluster,
  27. "Universe": Universe,
  28. "Multiverse": Multiverse,
  29. "Soldier": Soldier,
  30. "Tank": Tank,
  31. "Artillery": Artillery,
  32. "Helicopter": Helicopter,
  33. "Micro": Micro,
  34. "Macro": Macro,
  35. };
  36. var areas =
  37. {
  38. "Container": 0,
  39. "Person": 0.33,
  40. "Human": 0.33,
  41. "Cow": 2,
  42. "Car": 4,
  43. "Bus": 12,
  44. "Tram": 20,
  45. "House": 150,
  46. "Barn": 300,
  47. "Small Skyscraper": 1000,
  48. "Large Skyscraper": 2000,
  49. "Train": 40,
  50. "Train Car": 20,
  51. "Parking Garage": 750,
  52. "Town": 1e7,
  53. "City": 1e9,
  54. "Continent": 1.5e13,
  55. "Planet": 2.5e14,
  56. "Star": 3e18,
  57. "Solar System": 3e21,
  58. "Galaxy": 2e45,
  59. "Cluster": 2e49,
  60. "Universe": 7e53,
  61. "Multiverse": 5e56,
  62. "Soldier": 1,
  63. "Tank": 10,
  64. "Artillery": 12,
  65. "Helicopter": 8,
  66. "Micro": 0.05,
  67. "Macro": 100,
  68. };
  69. var masses =
  70. {
  71. "Container": 0,
  72. "Person": 80,
  73. "Human": 80,
  74. "Cow": 300,
  75. "Car": 1000,
  76. "Bus": 5000,
  77. "Tram": 10000,
  78. "House": 10000,
  79. "Barn": 5000,
  80. "Small Skyscraper": 10000000,
  81. "Large Skyscraper": 80000000,
  82. "Train": 50000,
  83. "Train Car": 7500,
  84. "Parking Garage": 10000000,
  85. "Town": 1,
  86. "City": 1,
  87. "Continent": 1e21,
  88. "Planet": 5.972e24,
  89. "Star": 1e40,
  90. "Solar System": 1,
  91. "Galaxy": 1,
  92. "Cluster": 1,
  93. "Universe": 1,
  94. "Multiverse": 1,
  95. "Soldier": 80,
  96. "Tank": 5000,
  97. "Artillery": 7000,
  98. "Helicopter": 1500,
  99. "Micro": 0.01,
  100. "Macro": 80000,
  101. };
  102. var clusters =
  103. {
  104. "Container": 0,
  105. "Person": 5,
  106. "Human": 5,
  107. "Cow": 15,
  108. "Car": 3,
  109. "Bus": 1,
  110. "Tram": 1,
  111. "House": 5,
  112. "Barn": 1,
  113. "Small Skyscraper": 2,
  114. "Large Skyscraper": 1,
  115. "Train": 2,
  116. "Train Car": 1,
  117. "Parking Garage": 1,
  118. "Town": 5,
  119. "City": 1,
  120. "Continent": 5,
  121. "Planet": 1,
  122. "Star": 1,
  123. "Solar System": 1,
  124. "Galaxy": 1,
  125. "Cluster": 1,
  126. "Universe": 1,
  127. "Multiverse": 1,
  128. "Soldier": 0,
  129. "Tank": 0,
  130. "Artillery": 0,
  131. "Helicopter": 0,
  132. "Micro": 10,
  133. "Macro": 0,
  134. };
  135. var cluster_chances =
  136. {
  137. "Container": 0,
  138. "Person": 0.8,
  139. "Human": 0.8,
  140. "Cow": 0.5,
  141. "Car": 0.5,
  142. "Bus": 0.25,
  143. "Tram": 0.2,
  144. "House": 0.5,
  145. "Barn": 0.1,
  146. "Small Skyscraper": 0.25,
  147. "Large Skyscraper": 0.25,
  148. "Train": 0.1,
  149. "Train Car": 0.05,
  150. "Parking Garage": 0.1,
  151. "Town": 0.1,
  152. "City": 0.2,
  153. "Continent": 0.5,
  154. "Planet": 1,
  155. "Star": 1,
  156. "Solar System": 1,
  157. "Galaxy": 1,
  158. "Cluster": 1,
  159. "Universe": 1,
  160. "Multiverse": 1,
  161. "Soldier": 0,
  162. "Tank": 0,
  163. "Artillery": 0,
  164. "Helicopter": 0,
  165. "Micro": 10,
  166. "Macro": 0,
  167. };
  168. var contents =
  169. {
  170. "Container": [],
  171. "Person": [],
  172. "Human": [],
  173. "Cow": [],
  174. "Car": [["Person",1,4]],
  175. "Bus": [["Person",2,30]],
  176. "Tram": [["Person",10,50]],
  177. "Train": [["Person",1,4,"engine"],["Train Car",2,10]],
  178. "Train Car": [["Person",10,40]],
  179. "House": [["Person",0,8],["Empty Car",0,2]],
  180. "Barn": [["Person",0,2],["Cow",30,70]],
  181. "Small Skyscraper": [["Person",150,750],["Empty Car",10,50]],
  182. "Large Skyscraper": [["Person",500,1500],["Empty Car",20,100]],
  183. "Parking Garage": [["Person",10,200],["Empty Car",100,300],["Car",5,30]],
  184. "Town": [["Person",10000,100000],["House",5000,50000],["Empty Car",200,800],["Car",500,80000],["Bus",5,25],["Train",5,25]],
  185. "City": [["Person",100000,1500000],["House",20000,200000],["Empty Car",10000,100000],["Car",7500,125000],["Bus",200,400],["Train",10,50],["Tram",25,100],["Small Skyscraper",50,300],["Large Skyscraper",10,75],["Parking Garage",5,10]],
  186. "Continent": [["Person",1000000,15000000],["House",2500,10000],["Car",25000,375000],["Train",50,500],["Town",500,1000],["City",50,250]],
  187. "Planet": [["Continent",4,9]],
  188. "Star": [],
  189. "Solar System": [["Star",1,1],["Planet",5,15]],
  190. "Galaxy": [["Star",1e9,500e9],["Solar System",1e8,500e8]],
  191. "Cluster": [["Galaxy",200,5000]],
  192. "Universe": [["Cluster",1.5e9,2.5e9]],
  193. "Multiverse": [["Universe",100,1000]],
  194. "Soldier": [],
  195. "Tank": [["Soldier",3,5]],
  196. "Artillery": [["Soldier",4,6]],
  197. "Helicopter": [["Soldier",4,16]],
  198. "Micro": [[]],
  199. "Macro": [[]]
  200. };
  201. // replace all instances of from with to
  202. function contents_substitute(from,to) {
  203. for (let key in contents) {
  204. if (contents.hasOwnProperty(key)) {
  205. let type = contents[key];
  206. for (let i=0; i<type.length; i++) {
  207. if (type[i][0] == from) {
  208. type[i][0] = to;
  209. }
  210. }
  211. }
  212. }
  213. }
  214. // remove all instances of thing
  215. function contents_remove(thing) {
  216. for (let key in contents) {
  217. if (contents.hasOwnProperty(key)) {
  218. let type = contents[key];
  219. for (let i=0; i<type.length; i++) {
  220. if (type[i][0] == thing) {
  221. type.splice(i,1);
  222. --i;
  223. }
  224. }
  225. }
  226. }
  227. }
  228. // adds thing to parent
  229. function contents_insert(parent,thing,min,max,label) {
  230. let owner = contents[parent];
  231. if (label == undefined)
  232. owner.push([thing,min,max]);
  233. else
  234. owner.push([thing,min,max,label]);
  235. }
  236. function initContents(name,count) {
  237. let result = {};
  238. let type = contents[name];
  239. for (let i=0; i<type.length; i++) {
  240. let amount = distribution(type[i][1],type[i][2],count);
  241. if (amount > 0) {
  242. // if a custom label is supplied, use it!
  243. if (type[i].length == 4)
  244. result[type[i][3]] = new things[type[i][0]](amount);
  245. else
  246. result[type[i][0]] = new things[type[i][0]](amount);
  247. }
  248. }
  249. return result;
  250. }
  251. function get_living_prey(sum) {
  252. let total = 0;
  253. for (let key in sum) {
  254. if (sum.hasOwnProperty(key)) {
  255. if (key == "Micro" || key == "Macro" || key == "Person" || key == "Cow" || key == 'Soldier')
  256. total += sum[key];
  257. }
  258. }
  259. return total;
  260. }
  261. // general logic: each step fills in a fraction of the remaining space
  262. function fill_area(area, weights, variance=0.15)
  263. {
  264. area = area + Math.random() * variance * 2 * area - variance * area;
  265. var result = [];
  266. var candidates = [];
  267. for (var key in weights) {
  268. if (weights.hasOwnProperty(key)) {
  269. candidates.push({"name": key, "area": areas[key], "weight": weights[key]});
  270. }
  271. }
  272. candidates = candidates.sort(function (x,y) {
  273. return x.area - y.area;
  274. });
  275. while(candidates.length > 0) {
  276. var candidate = candidates.pop();
  277. if (candidate.area > area)
  278. continue;
  279. var max = Math.floor(area / candidate.area);
  280. var limit = Math.min(max, 100);
  281. var count = 0;
  282. var loopvar = limit;
  283. // for small amounts, actually do the randomness
  284. // the first few ones get a much better shot
  285. // if we have nothing at all, it's even better!
  286. if (limit > 0 && result.length == 0) {
  287. ++count;
  288. ++loopvar;
  289. }
  290. while (loopvar < limit) {
  291. if (loopvar <= clusters[candidate.name] && loopvar == 0 && Math.random() < cluster_chances[candidate.name]) {
  292. ++count;
  293. }
  294. else if (loopvar <= clusters[candidate.name]) {
  295. if (Math.random() < candidate.weight ? 1 : 0 || Math.random() < 0.75 * cluster_chances[candidate.name]) {
  296. ++count;
  297. }
  298. }
  299. else {
  300. count += Math.random() < candidate.weight ? 1 : 0;
  301. }
  302. ++loopvar;
  303. }
  304. if (limit < max) {
  305. count += Math.round((max-limit) * candidate.weight);
  306. }
  307. area -= count * candidate.area;
  308. if (count > 0)
  309. result.push(new things[candidate.name](count));
  310. }
  311. return new Container(result);
  312. }
  313. // describes everything in the container
  314. function describe_all(contents,verbose=true,except=[]) {
  315. var things = [];
  316. for (var key in contents) {
  317. if (contents.hasOwnProperty(key) && !except.includes(key)) {
  318. things.push(contents[key].describe(verbose));
  319. }
  320. }
  321. return merge_things(things);
  322. }
  323. function random_desc(list, odds=1) {
  324. if (Math.random() < odds)
  325. return list[Math.floor(Math.random() * list.length)];
  326. else
  327. return "";
  328. }
  329. // combine strings into a list with proper grammar
  330. function merge_things(list,semicolons=false) {
  331. if (list.length == 0) {
  332. return "";
  333. } else if (list.length == 1) {
  334. return list[0];
  335. } else if (list.length == 2) {
  336. return list[0] + " and " + list[1];
  337. } else {
  338. var result = "";
  339. list.slice(0,list.length-1).forEach(function(term) {
  340. result += term + ", ";
  341. });
  342. result += "and " + list[list.length-1];
  343. return result;
  344. }
  345. }
  346. // combine the adjectives for something into a single string
  347. function merge_desc(list) {
  348. var result = "";
  349. list.forEach(function(term) {
  350. if (term != "")
  351. result += term + " ";
  352. });
  353. // knock off the last space
  354. if (result.length > 0) {
  355. result = result.substring(0, result.length - 1);
  356. }
  357. return result;
  358. }
  359. // maybe make this something that approximates a
  360. // normal distribution; doing this 15,000,000 times is bad...
  361. // solution: only a few are random lul
  362. // improvement: take up to 100 samples, then use that to scale the final result
  363. function distribution(min, max, samples) {
  364. var result = 0;
  365. var limit = Math.min(100,samples);
  366. if (limit < samples) {
  367. let dist = 0;
  368. for (let i = 0; i < limit; i++) {
  369. dist += Math.random();
  370. }
  371. dist /= 100;
  372. return Math.floor(dist * samples * (max - min + 1) + samples * min);
  373. } else {
  374. for (let i = 0; i < limit; i++) {
  375. result += Math.floor(Math.random() * (max - min + 1) + min);
  376. }
  377. }
  378. return result;
  379. }
  380. function defaultMultiply(thing) {
  381. return function(amount) {
  382. thing.count *= amount;
  383. for (var key in thing.contents) {
  384. if (thing.contents.hasOwnProperty(key)) {
  385. thing.contents[key].multiply(amount);
  386. }
  387. }
  388. };
  389. }
  390. function defaultArea(thing) {
  391. return areas[thing.name];
  392. }
  393. function defaultMass(thing) {
  394. return masses[thing.name];
  395. }
  396. function defaultMerge(thing) {
  397. return function(container) {
  398. var newCount = this.count + container.count;
  399. var newThing = new things[thing.name](newCount);
  400. newThing.contents = {};
  401. for (var key in this.contents) {
  402. if (this.contents.hasOwnProperty(key)) {
  403. newThing.contents[key] = this.contents[key];
  404. }
  405. }
  406. for (key in container.contents) {
  407. if (container.contents.hasOwnProperty(key)) {
  408. if (this.contents.hasOwnProperty(key)) {
  409. newThing.contents[key] = this.contents[key].merge(container.contents[key]);
  410. } else {
  411. newThing.contents[key] = container.contents[key];
  412. }
  413. }
  414. }
  415. return newThing;
  416. };
  417. }
  418. function listSum(sum) {
  419. let result = [];
  420. for (let key in sum) {
  421. if (sum.hasOwnProperty(key)) {
  422. result.push(new things[key](sum[key]).describe(false));
  423. }
  424. }
  425. return merge_things(result);
  426. }
  427. // turn a nested object into a container with everything on one level
  428. function flatten(thing) {
  429. let dict = defaultSum(thing)();
  430. let list = [];
  431. Object.entries(dict).forEach(function([key, val]) {
  432. let obj = new things[key](val);
  433. obj.contents = [];
  434. list.push(obj);
  435. });
  436. list.sort(function(x,y) {
  437. if (y.area != x.area){
  438. return y.area - x.area;
  439. } else {
  440. return x.name.localeCompare(y.name);
  441. }
  442. });
  443. return new Container(list);
  444. }
  445. function defaultSum(thing) {
  446. return function() {
  447. var counts = {};
  448. if (thing.name != "Container")
  449. counts[thing.name] = thing.count;
  450. for (var key in thing.contents) {
  451. if (thing.contents.hasOwnProperty(key)) {
  452. var subcount = thing.contents[key].sum();
  453. for (var subkey in subcount) {
  454. if (!counts.hasOwnProperty(subkey)) {
  455. counts[subkey] = 0;
  456. }
  457. counts[subkey] += subcount[subkey];
  458. }
  459. }
  460. }
  461. return counts;
  462. };
  463. }
  464. function defaultSumProperty(thing) {
  465. return function(prop) {
  466. var total = 0;
  467. total += thing[prop] * thing.count;
  468. for (var key in thing.contents) {
  469. if (thing.contents.hasOwnProperty(key)) {
  470. total += thing.contents[key].sum_property(prop);
  471. }
  472. }
  473. return total;
  474. };
  475. }
  476. function defaultAddContent(thing) {
  477. return function(name, min, max, count) {
  478. if (min == max) {
  479. let object = new things[name](min*count);
  480. thing.contents[object.name] = object;
  481. } else {
  482. let object = new things[name](distribution(min, max, count));
  483. thing.contents[object.name] = object;
  484. }
  485. };
  486. }
  487. function defaultDescribeSimple(thing) {
  488. return function(flat) {
  489. if (flat) {
  490. return flatten(thing).describe(false)
  491. } else {
  492. return thing.describe(false);
  493. }
  494. }
  495. }
  496. function DefaultEntity() {
  497. this.sum = defaultSum;
  498. this.area = defaultArea;
  499. this.mass = defaultMass;
  500. this.sum_property = defaultSumProperty;
  501. this.merge = defaultMerge;
  502. this.multiply = defaultMultiply;
  503. this.describeSimple = defaultDescribeSimple;
  504. return this;
  505. }
  506. // god I love reinventing the wheel
  507. function copy_defaults(self,proto) {
  508. for (var key in proto) {
  509. if (proto.hasOwnProperty(key)) {
  510. self[key] = proto[key](self);
  511. }
  512. }
  513. }
  514. function Container(contents = []) {
  515. this.name = "Container";
  516. copy_defaults(this,new DefaultEntity());
  517. if (Number.isInteger(contents))
  518. this.count = contents;
  519. else
  520. this.count = 0;
  521. this.contents = {};
  522. for (var i=0; i < contents.length; i++) {
  523. this.contents[contents[i].name] = contents[i];
  524. }
  525. for (var key in this.contents) {
  526. if (this.contents.hasOwnProperty(key)) {
  527. this.count += this.contents[key].count;
  528. }
  529. }
  530. this.describe = function(verbose = true) {
  531. return describe_all(this.contents,verbose);
  532. };
  533. return this;
  534. }
  535. function Person(count = 1) {
  536. this.name = "Person";
  537. copy_defaults(this,new DefaultEntity());
  538. this.count = count;
  539. this.contents = initContents(this.name,this.count);
  540. this.describeOne = function (verbose=true) {
  541. var body = random_desc(["skinny","fat","tall","short","stocky","spindly"], (verbose ? 0.6 : 0));
  542. var sex = random_desc(["male", "female"], (verbose ? 1 : 0));
  543. var species = "";
  544. species = random_desc(["wolf","cat","dog","squirrel","horse","hyena","fox","jackal","crux","sergal"]);
  545. return "a " + merge_desc([body,sex,species]);
  546. };
  547. this.describe = function(verbose=true) {
  548. if (verbose) {
  549. if (count <= 3) {
  550. var list = [];
  551. for (var i = 0; i < count; i++) {
  552. list.push(this.describeOne(this.count <= 2));
  553. }
  554. return merge_things(list);
  555. } else {
  556. return this.count + " people";
  557. }
  558. } else {
  559. return (this.count > 1 ? this.count + " people" : "a person");
  560. }
  561. };
  562. return this;
  563. }
  564. function Human(count = 1) {
  565. this.name = "Person";
  566. copy_defaults(this,new DefaultEntity());
  567. this.count = count;
  568. this.contents = initContents(this.name,this.count);
  569. this.describeOne = function (verbose=true) {
  570. var body = random_desc(["skinny","fat","tall","short","stocky","spindly"], (verbose ? 0.6 : 0));
  571. var sex = random_desc(["man", "woman"], 1);
  572. return "a " + merge_desc([body,sex]);
  573. };
  574. this.describe = function(verbose=true) {
  575. if (verbose) {
  576. if (count <= 3) {
  577. var list = [];
  578. for (var i = 0; i < count; i++) {
  579. list.push(this.describeOne(this.count <= 2));
  580. }
  581. return merge_things(list);
  582. } else {
  583. return this.count + " people";
  584. }
  585. } else {
  586. return (this.count > 1 ? this.count + " people" : "a person");
  587. }
  588. };
  589. return this;
  590. }
  591. function Cow(count = 1) {
  592. this.name = "Cow";
  593. copy_defaults(this,new DefaultEntity());
  594. this.count = count;
  595. this.contents = initContents(this.name,this.count);
  596. this.describeOne = function (verbose=true) {
  597. var body = random_desc(["skinny","fat","tall","short","stocky","spindly"], (verbose ? 0.6 : 0));
  598. var sex = random_desc(["male", "female"], (verbose ? 1 : 0));
  599. return "a " + merge_desc([body,sex,"cow"]);
  600. };
  601. this.describe = function(verbose=true) {
  602. if (verbose) {
  603. if (count <= 3) {
  604. var list = [];
  605. for (var i = 0; i < count; i++) {
  606. list.push(this.describeOne(this.count <= 2));
  607. }
  608. return merge_things(list);
  609. } else {
  610. return this.count + " cattle";
  611. }
  612. } else {
  613. return (this.count > 1 ? this.count + " cattle" : "a cow");
  614. }
  615. };
  616. return this;
  617. }
  618. function EmptyCar(count = 1) {
  619. this.name = "Car";
  620. copy_defaults(this,new DefaultEntity());
  621. this.count = count;
  622. this.contents = initContents(this.name,this.count);
  623. this.describeOne = function(verbose=true) {
  624. var color = random_desc(["black","black","gray","gray","blue","red","tan","white","white"]);
  625. var adjective = random_desc(["rusty","brand-new"],0.3);
  626. var type = random_desc(["SUV","coupe","sedan","truck","van","convertible"]);
  627. return "a parked " + merge_desc([adjective,color,type]);
  628. };
  629. this.describe = function(verbose = true) {
  630. if (verbose) {
  631. if (this.count <= 3) {
  632. var list = [];
  633. for (var i = 0; i < this.count; i++) {
  634. list.push(this.describeOne());
  635. }
  636. return merge_things(list);
  637. } else {
  638. return this.count + " parked cars";
  639. }
  640. } else {
  641. return (this.count > 1 ? this.count + " parked cars" : "a parked car");
  642. }
  643. };
  644. }
  645. function Car(count = 1) {
  646. this.name = "Car";
  647. copy_defaults(this,new DefaultEntity());
  648. this.count = count;
  649. this.contents = initContents(this.name,this.count);
  650. this.describeOne = function(verbose=true) {
  651. var color = random_desc(["black","black","gray","gray","blue","red","tan","white","white"], (verbose ? 1 : 0));
  652. var adjective = random_desc(["rusty","brand-new"], (verbose ? 0.3 : 0));
  653. var type = random_desc(["SUV","coupe","sedan","truck","van","convertible"]);
  654. return "a " + merge_desc([adjective,color,type]);
  655. };
  656. this.describe = function(verbose = true) {
  657. if (verbose) {
  658. if (this.count <= 3) {
  659. var list = [];
  660. for (var i = 0; i < this.count; i++) {
  661. list.push(this.describeOne(this.count < 2));
  662. }
  663. return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside";
  664. } else {
  665. return this.count + " cars with " + describe_all(this.contents,verbose) + " inside";
  666. }
  667. } else {
  668. return (this.count > 1 ? this.count + " cars" : "a car");
  669. }
  670. };
  671. }
  672. function Bus(count = 1) {
  673. this.name = "Bus";
  674. copy_defaults(this,new DefaultEntity());
  675. this.count = count;
  676. this.contents = initContents(this.name,this.count);
  677. this.describeOne = function(verbose=true) {
  678. var adjective = random_desc(["rusty","brand-new"], (verbose ? 0.3 : 0));
  679. var color = random_desc(["black","tan","gray"], (verbose ? 1 : 0));
  680. var type = random_desc(["bus","double-decker bus","articulating bus"]);
  681. return "a " + merge_desc([adjective,color,type]);
  682. };
  683. this.describe = function(verbose = true) {
  684. if (verbose) {
  685. if (this.count <= 3) {
  686. var list = [];
  687. for (var i = 0; i < this.count; i++) {
  688. list.push(this.describeOne(this.count < 2));
  689. }
  690. return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside";
  691. } else {
  692. return this.count + " buses with " + describe_all(this.contents,verbose) + " inside";
  693. }
  694. } else {
  695. return (this.count > 1 ? this.count + " buses" : "a bus");
  696. }
  697. };
  698. }
  699. function Tram(count = 1) {
  700. this.name = "Tram";
  701. copy_defaults(this,new DefaultEntity());
  702. this.count = count;
  703. this.contents = initContents(this.name,this.count);
  704. this.describeOne = function(verbose=true) {
  705. var adjective = random_desc(["rusty","weathered"], (verbose ? 0.3 : 0));
  706. var color = random_desc(["blue","brown","gray"], (verbose ? 1 : 0));
  707. var type = random_desc(["tram"]);
  708. return "a " + merge_desc([adjective,color,type]);
  709. };
  710. this.describe = function(verbose = true) {
  711. if (verbose) {
  712. if (this.count == 1) {
  713. var list = [];
  714. for (var i = 0; i < this.count; i++) {
  715. list.push(this.describeOne(verbose));
  716. }
  717. return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside";
  718. } else {
  719. return this.count + " trams with " + describe_all(this.contents,verbose) + " inside";
  720. }
  721. } else {
  722. return (this.count > 1 ? this.count + " trams" : "a tram");
  723. }
  724. };
  725. this.anal_vore = function() {
  726. return "You slide " + this.describe() + " up your tight ass";
  727. };
  728. }
  729. function Train(count = 1) {
  730. this.name = "Train";
  731. copy_defaults(this,new DefaultEntity());
  732. this.count = count;
  733. this.contents = initContents(this.name,this.count);
  734. this.describeOne = function(verbose=true) {
  735. var adjective = random_desc(["rusty","brand-new"], (verbose ? 0.3 : 0));
  736. var color = random_desc(["black","tan","gray"], (verbose ? 1 : 0));
  737. var type = random_desc(["train","passenger train","freight train"]);
  738. return "a " + merge_desc([adjective,color,type]);
  739. };
  740. this.describe = function(verbose = true) {
  741. if (verbose) {
  742. if (this.count == 1) {
  743. var list = [];
  744. for (var i = 0; i < this.count; i++) {
  745. list.push(this.describeOne(verbose));
  746. }
  747. return merge_things(list) + " with " + this.contents["engine"].describe(false) + " in the engine and " + this.contents["Train Car"].describe() + " attached";
  748. } else {
  749. return this.count + " trains with " + this.contents["engine"].describe(false) + " in the engine and " + this.contents["Train Car"].describe() + " attached";
  750. }
  751. } else {
  752. return (this.count > 1 ? this.count + " trains" : "a train");
  753. }
  754. };
  755. this.anal_vore = function() {
  756. var cars = (this.contents["Train Car"].count == 1 ? this.contents["Train Car"].describe() + " follows it inside" : this.contents["Train Car"].describe() + " are pulled slowly inside");
  757. return "You snatch up " + this.describeOne() + " and stuff it into your pucker, moaning as " + cars;
  758. };
  759. }
  760. function TrainCar(count = 1) {
  761. this.name = "Train Car";
  762. copy_defaults(this,new DefaultEntity());
  763. this.count = count;
  764. this.contents = initContents(this.name,this.count);
  765. this.describeOne = function(verbose=true) {
  766. var adjective = random_desc(["rusty","brand-new"], (verbose ? 0.3 : 0));
  767. var color = random_desc(["black","tan","gray"], (verbose ? 1 : 0));
  768. var type = random_desc(["train car","passenger train car","freight train car"]);
  769. return "a " + merge_desc([adjective,color,type]);
  770. };
  771. this.describe = function(verbose = true) {
  772. if (verbose) {
  773. return (this.count > 1 ? this.count + " train cars" : "a train car") + " with " + describe_all(this.contents) + " inside";
  774. } else {
  775. return (this.count > 1 ? this.count + " train cars" : "a train car");
  776. }
  777. };
  778. }
  779. function House(count = 1) {
  780. this.name = "House";
  781. copy_defaults(this,new DefaultEntity());
  782. this.count = count;
  783. this.contents = initContents(this.name,this.count);
  784. this.describeOne = function(verbose=true) {
  785. var size = random_desc(["little","two-story","large"], (verbose ? 0.5 : 0));
  786. var color = random_desc(["blue","white","gray","tan","green"], (verbose ? 0.5 : 0));
  787. var name = random_desc(["house","house","house","house","house","trailer"], 1);
  788. return "a " + merge_desc([size,color,name]);
  789. };
  790. this.describe = function(verbose = true) {
  791. if (verbose) {
  792. if (this.count <= 3) {
  793. var list = [];
  794. for (var i = 0; i < this.count; i++) {
  795. list.push(this.describeOne(this.count < 2));
  796. }
  797. return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside";
  798. } else {
  799. return this.count + " homes with " + describe_all(this.contents,verbose) + " inside";
  800. }
  801. } else {
  802. return (this.count > 1 ? this.count + " houses" : "a house");
  803. }
  804. };
  805. }
  806. function Barn(count = 1) {
  807. this.name = "Barn";
  808. copy_defaults(this,new DefaultEntity());
  809. this.count = count;
  810. this.contents = initContents(this.name,this.count);
  811. this.describeOne = function(verbose=true) {
  812. var size = random_desc(["little","big","large"], (verbose ? 0.5 : 0));
  813. var color = random_desc(["blue","white","gray","tan","green"], (verbose ? 0.5 : 0));
  814. var name = random_desc(["barn","barn","barn","barn","barn","farmhouse"], 1);
  815. return "a " + merge_desc([size,color,name]);
  816. };
  817. this.describe = function(verbose = true) {
  818. if (verbose) {
  819. if (this.count <= 3) {
  820. var list = [];
  821. for (var i = 0; i < this.count; i++) {
  822. list.push(this.describeOne(this.count < 2));
  823. }
  824. return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside";
  825. } else {
  826. return this.count + " barns with " + describe_all(this.contents,verbose) + " inside";
  827. }
  828. } else {
  829. return (this.count > 1 ? this.count + " barns" : "a barn");
  830. }
  831. };
  832. }
  833. function SmallSkyscraper(count = 1) {
  834. this.name = "Small Skyscraper";
  835. copy_defaults(this,new DefaultEntity());
  836. this.count = count;
  837. this.contents = initContents(this.name,this.count);
  838. this.describeOne = function(verbose=true) {
  839. var color = random_desc(["blue","white","gray","tan","green"], (verbose ? 0.5 : 0));
  840. var name = random_desc(["skyscraper","office tower","office building"], 1);
  841. return "a " + merge_desc([color,name]);
  842. };
  843. this.describe = function(verbose = true) {
  844. if (verbose) {
  845. if (this.count <= 3) {
  846. var list = [];
  847. for (var i = 0; i < this.count; i++) {
  848. list.push(this.describeOne(this.count < 2));
  849. }
  850. return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside";
  851. } else {
  852. return this.count + " small skyscrapers with " + describe_all(this.contents,verbose) + " inside";
  853. }
  854. } else {
  855. return (this.count > 1 ? this.count + " small skyscrapers" : "a small skyscraper");
  856. }
  857. };
  858. }
  859. function LargeSkyscraper(count = 1) {
  860. this.name = "Large Skyscraper";
  861. copy_defaults(this,new DefaultEntity());
  862. this.count = count;
  863. this.contents = initContents(this.name,this.count);
  864. this.describeOne = function(verbose=true) {
  865. var color = random_desc(["blue","white","gray","tan","green"], (verbose ? 0.5 : 0));
  866. var name = random_desc(["skyscraper","office tower","office building"], 1);
  867. return "a " + merge_desc(["towering",color,name]);
  868. };
  869. this.describe = function(verbose = true) {
  870. if (verbose) {
  871. if (this.count <= 3) {
  872. var list = [];
  873. for (var i = 0; i < this.count; i++) {
  874. list.push(this.describeOne(this.count < 2));
  875. }
  876. return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside";
  877. } else {
  878. return this.count + " large skyscrapers with " + describe_all(this.contents,verbose) + " inside";
  879. }
  880. } else {
  881. return (this.count > 1 ? this.count + " large skyscrapers" : "a large skyscraper");
  882. }
  883. };
  884. }
  885. function ParkingGarage(count = 1) {
  886. this.name = "Parking Garage";
  887. copy_defaults(this,new DefaultEntity());
  888. this.count = count;
  889. this.contents = initContents(this.name,this.count);
  890. this.describeOne = function(verbose=true) {
  891. return "a parking garage";
  892. };
  893. this.describe = function(verbose = true) {
  894. if (verbose) {
  895. return (this.count == 1 ? "a parking garage" : this.count + " parking garages") + " with " + describe_all(this.contents, verbose) + " inside";
  896. } else {
  897. return (this.count == 1 ? "a parking garage" : this.count + " parking garages");
  898. }
  899. };
  900. }
  901. function Town(count = 1) {
  902. this.name = "Town";
  903. copy_defaults(this,new DefaultEntity());
  904. this.count = count;
  905. this.contents = initContents(this.name,this.count);
  906. this.describe = function(verbose = true) {
  907. if (verbose) {
  908. return (this.count == 1 ? "a town" : this.count + " towns") + " with " + describe_all(this.contents, verbose) + " in " + (this.count == 1 ? "it" : "them");
  909. } else {
  910. return (this.count == 1 ? "a town" : this.count + " towns");
  911. }
  912. };
  913. }
  914. function City(count = 1) {
  915. this.name = "City";
  916. copy_defaults(this,new DefaultEntity());
  917. this.count = count;
  918. this.contents = initContents(this.name,this.count);
  919. this.describe = function(verbose = true) {
  920. if (verbose) {
  921. return (this.count == 1 ? "a city" : this.count + " cities") + " with " + describe_all(this.contents, verbose) + " in " + (this.count == 1 ? "it" : "them");
  922. } else {
  923. return (this.count == 1 ? "a city" : this.count + " cities");
  924. }
  925. };
  926. }
  927. function Continent(count = 1) {
  928. this.name = "Continent";
  929. copy_defaults(this,new DefaultEntity());
  930. this.count = count;
  931. this.contents = initContents(this.name,this.count);
  932. this.describe = function(verbose = true) {
  933. if (verbose) {
  934. return (this.count == 1 ? "a continent" : this.count + " continents") + " with " + describe_all(this.contents, verbose) + " on " + (this.count == 1 ? "it" : "them");
  935. } else {
  936. return (this.count == 1 ? "a continent" : this.count + " continents");
  937. }
  938. };
  939. }
  940. function Planet(count = 1) {
  941. this.name = "Planet";
  942. copy_defaults(this,new DefaultEntity());
  943. this.count = count;
  944. this.contents = initContents(this.name,this.count);
  945. this.describe = function(verbose = true) {
  946. if (verbose) {
  947. return (this.count == 1 ? "a planet" : this.count + " planets") + " with " + describe_all(this.contents, verbose) + " on " + (this.count == 1 ? "it" : "them");
  948. } else {
  949. return (this.count == 1 ? "a planet" : this.count + " planets");
  950. }
  951. };
  952. }
  953. function Star(count = 1) {
  954. this.name = "Star";
  955. copy_defaults(this,new DefaultEntity());
  956. this.count = count;
  957. this.contents = initContents(this.name,this.count);
  958. this.describe = function(verbose = true) {
  959. return (this.count == 1 ? "a star" : this.count + " stars");
  960. };
  961. }
  962. function SolarSystem(count = 1) {
  963. this.name = "Solar System";
  964. copy_defaults(this,new DefaultEntity());
  965. this.count = count;
  966. this.contents = initContents(this.name,this.count);
  967. this.describe = function(verbose = true) {
  968. if (verbose) {
  969. return (this.count == 1 ? "a solar system" : this.count + " solar systems") + " made up of " + describe_all(this.contents, verbose);
  970. } else {
  971. return (this.count == 1 ? "a solar system" : this.count + " solar systems");
  972. }
  973. };
  974. }
  975. function Galaxy(count = 1) {
  976. this.name = "Galaxy";
  977. copy_defaults(this,new DefaultEntity());
  978. this.count = count;
  979. this.contents = initContents(this.name,this.count);
  980. this.describe = function(verbose = true) {
  981. if (verbose) {
  982. return (this.count == 1 ? "a galaxy" : this.count + " galaxies") + " made up of " + describe_all(this.contents, verbose);
  983. } else {
  984. return (this.count == 1 ? "a galaxy" : this.count + " galaxies");
  985. }
  986. };
  987. }
  988. function Cluster(count = 1) {
  989. this.name = "Cluster";
  990. copy_defaults(this,new DefaultEntity());
  991. this.count = count;
  992. this.contents = initContents(this.name,this.count);
  993. this.describe = function(verbose = true) {
  994. if (verbose) {
  995. return (this.count == 1 ? "a cluster" : this.count + " clusters") + " made up of " + describe_all(this.contents, verbose);
  996. } else {
  997. return (this.count == 1 ? "a cluster" : this.count + " clusters");
  998. }
  999. };
  1000. }
  1001. function Universe(count = 1) {
  1002. this.name = "Universe";
  1003. copy_defaults(this,new DefaultEntity());
  1004. this.count = count;
  1005. this.contents = initContents(this.name,this.count);
  1006. this.describe = function(verbose = true) {
  1007. if (verbose) {
  1008. return (this.count == 1 ? "a universe" : this.count + " universes") + " made up of " + describe_all(this.contents, verbose);
  1009. } else {
  1010. return (this.count == 1 ? "a universe" : this.count + " universes");
  1011. }
  1012. };
  1013. }
  1014. function Multiverse(count = 1) {
  1015. this.name = "Multiverse";
  1016. copy_defaults(this,new DefaultEntity());
  1017. this.count = count;
  1018. this.contents = initContents(this.name,this.count);
  1019. this.describe = function(verbose = true) {
  1020. if (verbose) {
  1021. return (this.count == 1 ? "a multiverse" : this.count + " multiverses") + " made up of " + describe_all(this.contents, verbose);
  1022. } else {
  1023. return (this.count == 1 ? "a multiverse" : this.count + " multiverses");
  1024. }
  1025. };
  1026. }
  1027. function Soldier(count = 1) {
  1028. this.name = "Soldier";
  1029. copy_defaults(this,new DefaultEntity());
  1030. this.count = count;
  1031. this.contents = initContents(this.name,this.count);
  1032. this.describe = function(verbose = true) {
  1033. return (this.count == 1 ? "a soldier" : this.count + " soldiers");
  1034. };
  1035. }
  1036. function Tank(count = 1) {
  1037. this.name = "Tank";
  1038. copy_defaults(this,new DefaultEntity());
  1039. this.count = count;
  1040. this.contents = initContents(this.name,this.count);
  1041. this.describe = function(verbose = true) {
  1042. if (verbose) {
  1043. return (this.count == 1 ? "a tank" : this.count + " tanks") + " with " + describe_all(this.contents, verbose) + " trapped inside.";
  1044. } else {
  1045. return (this.count == 1 ? "a tank" : this.count + " tanks");
  1046. }
  1047. };
  1048. }
  1049. function Artillery(count = 1) {
  1050. this.name = "Artillery";
  1051. copy_defaults(this,new DefaultEntity());
  1052. this.count = count;
  1053. this.contents = initContents(this.name,this.count);
  1054. this.describe = function(verbose = true) {
  1055. if (verbose) {
  1056. return (this.count == 1 ? "an artillery unit" : this.count + " artillery units") + " with " + describe_all(this.contents, verbose) + " trapped inside.";
  1057. } else {
  1058. return (this.count == 1 ? "an artillery unit" : this.count + " artillery units");
  1059. }
  1060. };
  1061. }
  1062. function Helicopter(count = 1) {
  1063. this.name = "Helicopter";
  1064. copy_defaults(this,new DefaultEntity());
  1065. this.count = count;
  1066. this.contents = initContents(this.name,this.count);
  1067. this.describe = function(verbose = true) {
  1068. if (verbose) {
  1069. return (this.count == 1 ? "a helicopter" : this.count + " helicopters") + " with " + describe_all(this.contents, verbose) + " riding inside.";
  1070. } else {
  1071. return (this.count == 1 ? "a helicopter" : this.count + " helicopters");
  1072. }
  1073. };
  1074. }
  1075. function Micro(count = 1) {
  1076. this.name = "Micro";
  1077. copy_defaults(this,new DefaultEntity());
  1078. this.count = count;
  1079. this.contents = initContents(this.name,this.count);
  1080. this.describe = function(verbose = true) {
  1081. return (this.count == 1 ? "a micro" : this.count + " micros");
  1082. };
  1083. }
  1084. function Macro(count = 1) {
  1085. this.name = "Macro";
  1086. copy_defaults(this,new DefaultEntity());
  1087. this.count = count;
  1088. this.contents = initContents(this.name,this.count);
  1089. this.describe = function(verbose = true) {
  1090. return (this.count == 1 ? "a smaller macro" : this.count + " smaller macros");
  1091. };
  1092. }