big steppy
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

1018 lines
26 KiB

  1. 'use strict';
  2. var things =
  3. {
  4. "Container": Container,
  5. "Person": Person,
  6. "Cow": Cow,
  7. "Empty Car": EmptyCar,
  8. "Car": Car,
  9. "Bus": Bus,
  10. "Tram": Tram,
  11. "Motorcycle": Motorcycle,
  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. "Overpass": Overpass,
  20. "Town": Town,
  21. "City": City,
  22. "Continent": Continent,
  23. "Planet": Planet,
  24. "Star": Star,
  25. "Solar System": SolarSystem,
  26. "Galaxy": Galaxy
  27. };
  28. var areas =
  29. {
  30. "Container": 0,
  31. "Person": 1,
  32. "Cow": 2,
  33. "Car": 4,
  34. "Bus": 12,
  35. "Tram": 20,
  36. "Motorcycle": 2,
  37. "House": 1000,
  38. "Barn": 750,
  39. "Small Skyscraper": 2500,
  40. "Large Skyscraper": 5000,
  41. "Train": 500,
  42. "TrainCar": 500,
  43. "Parking Garage": 10000,
  44. "Overpass": 10000,
  45. "Town": 1e7,
  46. "City": 1e9,
  47. "Continent": 1.5e13,
  48. "Planet": 2.5e14,
  49. "Star": 3e18,
  50. "Solar System": 3e21,
  51. "Galaxy": 2e42,
  52. };
  53. var masses =
  54. {
  55. "Container": 0,
  56. "Person": 80,
  57. "Cow": 300,
  58. "Car": 1000,
  59. "Bus": 5000,
  60. "Tram": 10000,
  61. "Motorcycle": 200,
  62. "House": 10000,
  63. "Barn": 5000,
  64. "Small Skyscraper": 10000000,
  65. "Large Skyscraper": 80000000,
  66. "Train": 50000,
  67. "Train Car": 7500,
  68. "Parking Garage": 10000000,
  69. "Overpass": 1000000,
  70. "Town": 1,
  71. "City": 1,
  72. "Continent": 1e21,
  73. "Planet": 5.972e24,
  74. "Star": 1e40,
  75. "Solar System": 1,
  76. "Galaxy": 1
  77. };
  78. var clusters =
  79. {
  80. "Container": 0,
  81. "Person": 5,
  82. "Cow": 15,
  83. "Car": 3,
  84. "Bus": 1,
  85. "Tram": 1,
  86. "Motorcycle": 1,
  87. "House": 5,
  88. "Barn": 1,
  89. "Small Skyscraper": 2,
  90. "Large Skyscraper": 1,
  91. "Train": 2,
  92. "Train Car": 1,
  93. "Parking Garage": 1,
  94. "Overpass": 1,
  95. "Town": 1,
  96. "City": 1,
  97. "Continent": 5,
  98. "Planet": 1,
  99. "Star": 1,
  100. "Solar System": 1,
  101. "Galaxy": 1
  102. };
  103. // general logic: each step fills in a fraction of the remaining space
  104. function fill_area(area, weights, variance=0.15)
  105. {
  106. var area = area + Math.random() * variance * 2 - variance;
  107. var result = [];
  108. var candidates = [];
  109. for (var key in weights) {
  110. if (weights.hasOwnProperty(key)) {
  111. candidates.push({"name": key, "area": areas[key], "weight": weights[key]});
  112. }
  113. }
  114. candidates = candidates.sort(function (x,y) {
  115. return x.area - y.area;
  116. });
  117. while(candidates.length > 0) {
  118. var candidate = candidates.pop();
  119. if (candidate.area > area)
  120. continue;
  121. var max = Math.floor(area / candidate.area);
  122. var limit = Math.min(max, 100);
  123. var count = 0;
  124. var loopvar = limit;
  125. // for small amounts, actually do the randomness
  126. // the first few ones get a much better shot
  127. while (loopvar > 0) {
  128. if (loopvar <= clusters[candidate.name])
  129. count += 1;
  130. else
  131. count += Math.random() < candidate.weight ? 1 : 0;
  132. --loopvar;
  133. }
  134. if (limit < max) {
  135. count += Math.round((max-limit) * candidate.weight);
  136. }
  137. area -= count * candidate.area;
  138. if (count > 0)
  139. result.push(new things[candidate.name](count));
  140. }
  141. if (result.length > 0)
  142. return new Container(result);
  143. else
  144. return new Container([new Person(1)]);
  145. }
  146. // describes everything in the container
  147. function describe_all(contents,verbose=true,except=[]) {
  148. var things = [];
  149. for (var key in contents) {
  150. if (contents.hasOwnProperty(key) && !except.includes(key)) {
  151. things.push(contents[key].describe(verbose));
  152. }
  153. }
  154. return merge_things(things);
  155. }
  156. function random_desc(list, odds=1) {
  157. if (Math.random() < odds)
  158. return list[Math.floor(Math.random() * list.length)];
  159. else
  160. return "";
  161. }
  162. // combine strings into a list with proper grammar
  163. function merge_things(list,semicolons=false) {
  164. if (list.length == 0) {
  165. return "";
  166. } else if (list.length == 1) {
  167. return list[0];
  168. } else if (list.length == 2) {
  169. return list[0] + " and " + list[1];
  170. } else {
  171. var result = "";
  172. list.slice(0,list.length-1).forEach(function(term) {
  173. result += term + ", ";
  174. })
  175. result += "and " + list[list.length-1]
  176. return result;
  177. }
  178. }
  179. // combine the adjectives for something into a single string
  180. function merge_desc(list) {
  181. var result = ""
  182. list.forEach(function(term) {
  183. if (term != "")
  184. result += term + " ";
  185. });
  186. // knock off the last space
  187. if (result.length > 0) {
  188. result = result.substring(0, result.length - 1);
  189. }
  190. return result;
  191. }
  192. // maybe make this something that approximates a
  193. // normal distribution; doing this 15,000,000 times is bad...
  194. // solution: only a few are random lul
  195. // improvement: take up to 100 samples, then use that to scale the final result
  196. function distribution(min, max, samples) {
  197. var result = 0;
  198. var limit = Math.min(100,samples)
  199. if (limit < samples) {
  200. for (var i = 0; i < limit; i++) {
  201. result += (i/10 + 1) * Math.floor(Math.random() * (max - min + 1) + min);
  202. }
  203. result = Math.round((result / 595) * samples * (max - min) + min);
  204. } else {
  205. for (var i = 0; i < limit; i++) {
  206. result += Math.floor(Math.random() * (max - min + 1) + min);
  207. }
  208. }
  209. return result;
  210. }
  211. function defaultArea(thing) {
  212. return areas[thing.name];
  213. }
  214. function defaultMass(thing) {
  215. return masses[thing.name];
  216. }
  217. function defaultMerge(thing) {
  218. return function(container) {
  219. var newCount = this.count + container.count;
  220. var newThing = new things[thing.name](newCount);
  221. newThing.contents = {};
  222. for (var key in this.contents) {
  223. if (this.contents.hasOwnProperty(key)) {
  224. newThing.contents[key] = this.contents[key];
  225. }
  226. }
  227. for (var key in container.contents) {
  228. if (container.contents.hasOwnProperty(key)) {
  229. if (this.contents.hasOwnProperty(key)) {
  230. newThing.contents[key] = this.contents[key].merge(container.contents[key]);
  231. } else {
  232. newThing.contents[key] = container.contents[key];
  233. }
  234. }
  235. }
  236. return newThing;
  237. }
  238. }
  239. function defaultSum(thing) {
  240. return function() {
  241. var counts = {}
  242. if (thing.name != "Container")
  243. counts[thing.name] = thing.count;
  244. for (var key in thing.contents) {
  245. if (thing.contents.hasOwnProperty(key)) {
  246. var subcount = thing.contents[key].sum();
  247. for (var subkey in subcount) {
  248. if (!counts.hasOwnProperty(subkey)) {
  249. counts[subkey] = 0;
  250. }
  251. counts[subkey] += subcount[subkey];
  252. }
  253. }
  254. }
  255. return counts;
  256. }
  257. }
  258. function defaultSumProperty(thing) {
  259. return function(prop) {
  260. var total = 0;
  261. total += thing[prop] * thing.count;
  262. for (var key in thing.contents) {
  263. if (thing.contents.hasOwnProperty(key)) {
  264. total += thing.contents[key].sum_property(prop);
  265. }
  266. }
  267. return total;
  268. }
  269. }
  270. function defaultAddContent(thing) {
  271. return function(name, min, max, count) {
  272. if (min == max) {
  273. var object = new things[name](min*count);
  274. thing.contents[object.name] = object;
  275. } else {
  276. var object = new things[name](distribution(min, max, count));
  277. thing.contents[object.name] = object;
  278. }
  279. }
  280. }
  281. function DefaultEntity() {
  282. this.sum = defaultSum;
  283. this.area = defaultArea;
  284. this.mass = defaultMass;
  285. this.sum_property = defaultSumProperty;
  286. this.merge = defaultMerge;
  287. this.addContent = defaultAddContent;
  288. return this;
  289. }
  290. // god I love reinventing the wheel
  291. function copy_defaults(self,proto) {
  292. for (var key in proto) {
  293. if (proto.hasOwnProperty(key)) {
  294. self[key] = proto[key](self)
  295. }
  296. }
  297. }
  298. function Container(contents = []) {
  299. this.name = "Container";
  300. copy_defaults(this,new DefaultEntity());
  301. if (Number.isInteger(contents))
  302. this.count = contents;
  303. else
  304. this.count = 0;
  305. this.contents = {}
  306. for (var i=0; i < contents.length; i++) {
  307. this.contents[contents[i].name] = contents[i];
  308. }
  309. for (var key in this.contents) {
  310. if (this.contents.hasOwnProperty(key)) {
  311. this.count += this.contents[key].count;
  312. }
  313. }
  314. this.describe = function(verbose = true) {
  315. return describe_all(this.contents,verbose)
  316. }
  317. return this;
  318. }
  319. function Person(count = 1) {
  320. this.name = "Person";
  321. copy_defaults(this,new DefaultEntity());
  322. this.count = count;
  323. this.contents = {};
  324. this.describeOne = function (verbose=true) {
  325. var body = random_desc(["skinny","fat","tall","short","stocky","spindly"], (verbose ? 0.6 : 0));
  326. var sex = random_desc(["male", "female"], (verbose ? 1 : 0));
  327. if (!humanMode)
  328. var species = random_desc(["wolf","cat","dog","squirrel","horse","hyena","fox","jackal","crux","sergal"]);
  329. else
  330. var species = random_desc(["jogger","police officer","road worker","pastor","dog-walker","clerk","accountant","CEO","millionaire","mailman"]);
  331. return "a " + merge_desc([body,sex,species]);
  332. }
  333. this.describe = function(verbose=true) {
  334. if (verbose) {
  335. if (count <= 3) {
  336. var list = [];
  337. for (var i = 0; i < count; i++) {
  338. list.push(this.describeOne(this.count <= 2));
  339. }
  340. return merge_things(list);
  341. } else {
  342. return this.count + " people"
  343. }
  344. } else {
  345. return (this.count > 1 ? this.count + " people" : "a person");
  346. }
  347. }
  348. return this;
  349. }
  350. function Cow(count = 1) {
  351. this.name = "Cow";
  352. copy_defaults(this,new DefaultEntity());
  353. this.count = count;
  354. this.contents = {};
  355. this.describeOne = function (verbose=true) {
  356. var body = random_desc(["skinny","fat","tall","short","stocky","spindly"], (verbose ? 0.6 : 0));
  357. var sex = random_desc(["male", "female"], (verbose ? 1 : 0));
  358. return "a " + merge_desc([body,sex,"cow"]);
  359. }
  360. this.describe = function(verbose=true) {
  361. if (verbose) {
  362. if (count <= 3) {
  363. var list = [];
  364. for (var i = 0; i < count; i++) {
  365. list.push(this.describeOne(this.count <= 2));
  366. }
  367. return merge_things(list);
  368. } else {
  369. return this.count + " cattle"
  370. }
  371. } else {
  372. return (this.count > 1 ? this.count + " cattle" : "a cow");
  373. }
  374. }
  375. return this;
  376. }
  377. function EmptyCar(count = 1) {
  378. this.name = "Car";
  379. copy_defaults(this,new DefaultEntity());
  380. this.count = count;
  381. this.contents = {};
  382. this.describeOne = function(verbose=true) {
  383. var color = random_desc(["black","black","gray","gray","blue","red","tan","white","white"]);
  384. var adjective = random_desc(["rusty","brand-new"],0.3);
  385. var type = random_desc(["SUV","coupe","sedan","truck","van","convertible"]);
  386. return "a parked " + merge_desc([adjective,color,type]);
  387. }
  388. this.describe = function(verbose = true) {
  389. if (verbose) {
  390. if (this.count <= 3) {
  391. var list = [];
  392. for (var i = 0; i < this.count; i++) {
  393. list.push(this.describeOne());
  394. }
  395. return merge_things(list);
  396. } else {
  397. return this.count + " parked cars";
  398. }
  399. } else {
  400. return (this.count > 1 ? this.count + " parked cars" : "a parked car");
  401. }
  402. }
  403. }
  404. function Car(count = 1) {
  405. this.name = "Car";
  406. copy_defaults(this,new DefaultEntity());
  407. this.count = count;
  408. this.contents = {};
  409. this.addContent("Person", 2, 5, count);
  410. this.describeOne = function(verbose=true) {
  411. var color = random_desc(["black","black","gray","gray","blue","red","tan","white","white"], (verbose ? 1 : 0));
  412. var adjective = random_desc(["rusty","brand-new"], (verbose ? 0.3 : 0));
  413. var type = random_desc(["SUV","coupe","sedan","truck","van","convertible"]);
  414. return "a " + merge_desc([adjective,color,type]);
  415. }
  416. this.describe = function(verbose = true) {
  417. if (verbose) {
  418. if (this.count <= 3) {
  419. var list = [];
  420. for (var i = 0; i < this.count; i++) {
  421. list.push(this.describeOne(this.count < 2));
  422. }
  423. return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside";
  424. } else {
  425. return this.count + " cars with " + describe_all(this.contents,verbose) + " inside";
  426. }
  427. } else {
  428. return (this.count > 1 ? this.count + " cars" : "a car");
  429. }
  430. }
  431. }
  432. function Bus(count = 1) {
  433. this.name = "Bus";
  434. copy_defaults(this,new DefaultEntity());
  435. this.count = count;
  436. this.contents = {};
  437. this.addContent("Person",10,35,count);
  438. this.describeOne = function(verbose=true) {
  439. var adjective = random_desc(["rusty","brand-new"], (verbose ? 0.3 : 0));
  440. var color = random_desc(["black","tan","gray"], (verbose ? 1 : 0));
  441. var type = random_desc(["bus","double-decker bus","articulating bus"]);
  442. return "a " + merge_desc([adjective,color,type]);
  443. }
  444. this.describe = function(verbose = true) {
  445. if (verbose) {
  446. if (this.count <= 3) {
  447. var list = [];
  448. for (var i = 0; i < this.count; i++) {
  449. list.push(this.describeOne(this.count < 2));
  450. }
  451. return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside";
  452. } else {
  453. return this.count + " buses with " + describe_all(this.contents,verbose) + " inside";
  454. }
  455. } else {
  456. return (this.count > 1 ? this.count + " buses" : "a bus");
  457. }
  458. }
  459. }
  460. function Tram(count = 1) {
  461. this.name = "Tram";
  462. copy_defaults(this,new DefaultEntity());
  463. this.count = count;
  464. this.contents = {};
  465. this.addContent("Person",40,60,count);
  466. this.describeOne = function(verbose=true) {
  467. var adjective = random_desc(["rusty","weathered"], (verbose ? 0.3 : 0));
  468. var color = random_desc(["blue","brown","gray"], (verbose ? 1 : 0));
  469. var type = random_desc(["tram"]);
  470. return "a " + merge_desc([adjective,color,type]);
  471. }
  472. this.describe = function(verbose = true) {
  473. if (verbose) {
  474. if (this.count == 1) {
  475. var list = [];
  476. for (var i = 0; i < this.count; i++) {
  477. list.push(this.describeOne(verbose));
  478. }
  479. return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside";
  480. } else {
  481. return this.count + " trams with " + describe_all(this.contents,verbose) + " inside";
  482. }
  483. } else {
  484. return (this.count > 1 ? this.count + " trams" : "a tram");
  485. }
  486. }
  487. this.anal_vore = function() {
  488. return "You slide " + this.describe() + " up your tight ass";
  489. }
  490. }
  491. function Motorcycle(count = 1) {
  492. this.name = "Motorcycle";
  493. copy_defaults(this,new DefaultEntity());
  494. this.count = count;
  495. this.contents = {};
  496. this.addContent("Person",1,2,count);
  497. }
  498. function Train(count = 1) {
  499. this.name = "Train";
  500. copy_defaults(this,new DefaultEntity());
  501. this.count = count;
  502. this.contents = {};
  503. this.addContent("Person", 1, 4, count);
  504. this.addContent("Train Car", 2, 10, count);
  505. this.describeOne = function(verbose=true) {
  506. var adjective = random_desc(["rusty","brand-new"], (verbose ? 0.3 : 0));
  507. var color = random_desc(["black","tan","gray"], (verbose ? 1 : 0));
  508. var type = random_desc(["train","passenger train","freight train"]);
  509. return "a " + merge_desc([adjective,color,type]);
  510. }
  511. this.describe = function(verbose = true) {
  512. if (verbose) {
  513. if (this.count == 1) {
  514. var list = [];
  515. for (var i = 0; i < this.count; i++) {
  516. list.push(this.describeOne(verbose));
  517. }
  518. return merge_things(list) + " with " + this.contents["Person"].describe(false) + " in the engine and " + this.contents["Train Car"].describe() + " attached";
  519. } else {
  520. return this.count + " trains with " + this.contents["Person"].describe(false) + " in the engine and " + this.contents["Train Car"].describe() + " attached";
  521. }
  522. } else {
  523. return (this.count > 1 ? this.count + " trains" : "a train");
  524. }
  525. }
  526. this.anal_vore = function() {
  527. 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");
  528. return "You snatch up " + this.describeOne() + " and stuff it into your pucker, moaning as " + cars;
  529. }
  530. }
  531. function TrainCar(count = 1) {
  532. this.name = "Train Car";
  533. copy_defaults(this,new DefaultEntity());
  534. this.count = count;
  535. this.contents = {};
  536. this.addContent("Person",10,40,count);
  537. this.describeOne = function(verbose=true) {
  538. var adjective = random_desc(["rusty","brand-new"], (verbose ? 0.3 : 0));
  539. var color = random_desc(["black","tan","gray"], (verbose ? 1 : 0));
  540. var type = random_desc(["train car","passenger train car","freight train car"]);
  541. return "a " + merge_desc([adjective,color,type]);
  542. }
  543. this.describe = function(verbose = true) {
  544. if (verbose) {
  545. return (this.count > 1 ? this.count + " train cars" : "a train car") + " with " + describe_all(this.contents) + " inside";
  546. } else {
  547. return (this.count > 1 ? this.count + " train cars" : "a train car");
  548. }
  549. }
  550. }
  551. function House(count = 1) {
  552. this.name = "House";
  553. copy_defaults(this,new DefaultEntity());
  554. this.count = count;
  555. this.contents = {};
  556. this.addContent("Person",0,8,count);
  557. this.addContent("Empty Car",0,2,count);
  558. this.describeOne = function(verbose=true) {
  559. var size = random_desc(["little","two-story","large"], (verbose ? 0.5 : 0));
  560. var color = random_desc(["blue","white","gray","tan","green"], (verbose ? 0.5 : 0));
  561. var name = random_desc(["house","house","house","house","house","trailer"], 1);
  562. return "a " + merge_desc([size,color,name]);
  563. }
  564. this.describe = function(verbose = true) {
  565. if (verbose) {
  566. if (this.count <= 3) {
  567. var list = [];
  568. for (var i = 0; i < this.count; i++) {
  569. list.push(this.describeOne(this.count < 2));
  570. }
  571. return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside";
  572. } else {
  573. return this.count + " homes with " + describe_all(this.contents,verbose) + " inside";
  574. }
  575. } else {
  576. return (this.count > 1 ? this.count + " houses" : "a house");
  577. }
  578. }
  579. }
  580. function Barn(count = 1) {
  581. this.name = "Barn";
  582. copy_defaults(this,new DefaultEntity());
  583. this.count = count;
  584. this.contents = {};
  585. this.addContent("Person",0,2,count);
  586. this.addContent("Cow",30,70,count);
  587. this.describeOne = function(verbose=true) {
  588. var size = random_desc(["little","big","large"], (verbose ? 0.5 : 0));
  589. var color = random_desc(["blue","white","gray","tan","green"], (verbose ? 0.5 : 0));
  590. var name = random_desc(["barn","barn","barn","barn","barn","farmhouse"], 1);
  591. return "a " + merge_desc([size,color,name]);
  592. }
  593. this.describe = function(verbose = true) {
  594. if (verbose) {
  595. if (this.count <= 3) {
  596. var list = [];
  597. for (var i = 0; i < this.count; i++) {
  598. list.push(this.describeOne(this.count < 2));
  599. }
  600. return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside";
  601. } else {
  602. return this.count + " barns with " + describe_all(this.contents,verbose) + " inside";
  603. }
  604. } else {
  605. return (this.count > 1 ? this.count + " barns" : "a barn");
  606. }
  607. }
  608. }
  609. function SmallSkyscraper(count = 1) {
  610. this.name = "Small Skyscraper";
  611. copy_defaults(this,new DefaultEntity());
  612. this.count = count;
  613. this.contents = {};
  614. this.addContent("Person",50,500,count);
  615. this.addContent("Empty Car",10,50,count);
  616. this.describeOne = function(verbose=true) {
  617. var color = random_desc(["blue","white","gray","tan","green"], (verbose ? 0.5 : 0));
  618. var name = random_desc(["skyscraper","office tower","office building"], 1);
  619. return "a " + merge_desc([color,name]);
  620. }
  621. this.describe = function(verbose = true) {
  622. if (verbose) {
  623. if (this.count <= 3) {
  624. var list = [];
  625. for (var i = 0; i < this.count; i++) {
  626. list.push(this.describeOne(this.count < 2));
  627. }
  628. return merge_things(list) + " with " + describe_all(this.contents,verbose) + " inside";
  629. } else {
  630. return this.count + " small skyscrapers with " + describe_all(this.contents,verbose) + " inside";
  631. }
  632. } else {
  633. return (this.count > 1 ? this.count + " small skyscrapers" : "a small skyscraper");
  634. }
  635. }
  636. this.anal_vore = function(verbose=true,height=10) {
  637. var line = skyscraperAnalVore(this,verbose,height);
  638. if (line == "")
  639. return defaultAnalVore(this)(verbose);
  640. else
  641. return line;
  642. };
  643. }
  644. function LargeSkyscraper(count = 1) {
  645. this.name = "Large Skyscraper";
  646. copy_defaults(this,new DefaultEntity());
  647. this.count = count;
  648. this.contents = {};
  649. this.addContent("Person",150,1500,count);
  650. this.addContent("Empty Car",20,100,count);
  651. this.describeOne = function(verbose=true) {
  652. var color = random_desc(["blue","white","gray","tan","green"], (verbose ? 0.5 : 0));
  653. var name = random_desc(["skyscraper","office tower","office building"], 1);
  654. return "a " + merge_desc(["towering",color,name]);
  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 + " large skyscrapers with " + describe_all(this.contents,verbose) + " inside";
  666. }
  667. } else {
  668. return (this.count > 1 ? this.count + " large skyscrapers" : "a large skyscraper");
  669. }
  670. }
  671. }
  672. function ParkingGarage(count = 1) {
  673. this.name = "Parking Garage";
  674. copy_defaults(this,new DefaultEntity());
  675. this.count = count;
  676. this.contents = {};
  677. this.addContent("Person",10,200,count);
  678. this.addContent("Empty Car",30,100,count);
  679. this.addContent("Car",5,30,count);
  680. this.describeOne = function(verbose=true) {
  681. return "a parking garage";
  682. }
  683. this.describe = function(verbose = true) {
  684. if (verbose) {
  685. return (this.count == 1 ? "a parking garage" : this.count + " parking garages") + " with " + describe_all(this.contents, verbose) + " inside";
  686. } else {
  687. return (this.count == 1 ? "a parking garage" : this.count + " parking garages");
  688. }
  689. }
  690. }
  691. function Overpass(count = 1) {
  692. this.name = "Overpass";
  693. copy_defaults(this,new DefaultEntity());
  694. this.count = count;
  695. this.contents = {};
  696. this.addContent("Person",0,20,count);
  697. this.addContent("Car",25,100,count);
  698. }
  699. function Town(count = 1) {
  700. this.name = "Town";
  701. copy_defaults(this,new DefaultEntity());
  702. this.count = count;
  703. this.contents = {};
  704. this.addContent("Person",1000,15000,count);
  705. this.addContent("House",500,10000,count);
  706. this.addContent("Empty Car",250,3750,count);
  707. this.addContent("Car",250,3750,count);
  708. this.addContent("Bus",50,150,count);
  709. this.addContent("Train",5,10,count);
  710. this.addContent("Small Skyscraper",2,10,count);
  711. this.addContent("Parking Garage",1,5,count);
  712. this.describe = function(verbose = true) {
  713. if (verbose) {
  714. return (this.count == 1 ? "a town" : this.count + " towns") + " with " + describe_all(this.contents, verbose) + " in " + (this.count == 1 ? "it" : "them");
  715. } else {
  716. return (this.count == 1 ? "a town" : this.count + " towns");
  717. }
  718. }
  719. }
  720. function City(count = 1) {
  721. this.name = "City";
  722. copy_defaults(this,new DefaultEntity());
  723. this.count = count;
  724. this.contents = {};
  725. this.addContent("Person",10000,150000,count);
  726. this.addContent("House",5000,100000,count);
  727. this.addContent("Empty Car",2500,37500,count);
  728. this.addContent("Car",2500,37500,count);
  729. this.addContent("Bus",150,500,count);
  730. this.addContent("Train",50,100,count);
  731. this.addContent("Tram",100,300,count);
  732. this.addContent("Small Skyscraper",20,100,count);
  733. this.addContent("Large Skyscraper",10,50,count);
  734. this.addContent("Parking Garage",10,50,count);
  735. this.describe = function(verbose = true) {
  736. if (verbose) {
  737. return (this.count == 1 ? "a city" : this.count + " cities") + " with " + describe_all(this.contents, verbose) + " in " + (this.count == 1 ? "it" : "them");
  738. } else {
  739. return (this.count == 1 ? "a city" : this.count + " cities");
  740. }
  741. }
  742. }
  743. function Continent(count = 1) {
  744. this.name = "Continent";
  745. copy_defaults(this,new DefaultEntity());
  746. this.count = count;
  747. this.contents = {};
  748. this.addContent("Person",100000,1500000,count);
  749. this.addContent("House",5000,100000,count);
  750. this.addContent("Car",25000,375000,count);
  751. this.addContent("Train",500,1000,count);
  752. this.addContent("Town",2000,5000,count);
  753. this.addContent("City",200,500,count);
  754. this.describe = function(verbose = true) {
  755. if (verbose) {
  756. return (this.count == 1 ? "a continent" : this.count + " continents") + " with " + describe_all(this.contents, verbose) + " on " + (this.count == 1 ? "it" : "them");
  757. } else {
  758. return (this.count == 1 ? "a continent" : this.count + " continents");
  759. }
  760. }
  761. }
  762. function Planet(count = 1) {
  763. this.name = "Planet";
  764. copy_defaults(this,new DefaultEntity());
  765. this.count = count;
  766. this.contents = {};
  767. this.addContent("Continent",4,9,count);
  768. this.describe = function(verbose = true) {
  769. if (verbose) {
  770. return (this.count == 1 ? "a planet" : this.count + " planets") + " with " + describe_all(this.contents, verbose) + " on " + (this.count == 1 ? "it" : "them");
  771. } else {
  772. return (this.count == 1 ? "a planet" : this.count + " planets");
  773. }
  774. }
  775. }
  776. function Star(count = 1) {
  777. this.name = "Star";
  778. copy_defaults(this,new DefaultEntity());
  779. this.count = count;
  780. this.contents = {};
  781. this.describe = function(verbose = true) {
  782. return (this.count == 1 ? "a star" : this.count + " stars");
  783. }
  784. }
  785. function SolarSystem(count = 1) {
  786. this.name = "Solar System";
  787. copy_defaults(this,new DefaultEntity());
  788. this.count = count;
  789. this.contents = {};
  790. this.addContent("Star",1,1,count);
  791. this.addContent("Planet",5,15,count);
  792. this.describe = function(verbose = true) {
  793. if (verbose) {
  794. return (this.count == 1 ? "a solar system" : this.count + " solar systems") + " made up of " + describe_all(this.contents, verbose);
  795. } else {
  796. return (this.count == 1 ? "a solar system" : this.count + " solar systems");
  797. }
  798. }
  799. }
  800. function Galaxy(count = 1) {
  801. this.name = "Galaxy";
  802. copy_defaults(this,new DefaultEntity());
  803. this.count = count;
  804. this.contents = {};
  805. this.addContent("Star",1e9,500e9,count);
  806. this.addContent("Solar System",1e8,500e8,count);
  807. this.describe = function(verbose = true) {
  808. if (verbose) {
  809. return (this.count == 1 ? "a galaxy" : this.count + " galaxies") + " made up of " + describe_all(this.contents, verbose);
  810. } else {
  811. return (this.count == 1 ? "a galaxy" : this.count + " galaxies");
  812. }
  813. }
  814. }