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.
 
 
 

1014 line
26 KiB

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