big steppy
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 

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