big steppy
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 

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