big steppy
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

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