Skip to content

Instantly share code, notes, and snippets.

View tommyettinger's full-sized avatar
⚙️
Keeping the commit streak alive

Tommy Ettinger tommyettinger

⚙️
Keeping the commit streak alive
View GitHub Profile
@tommyettinger
tommyettinger / Select.java
Created October 26, 2016 01:42
Select a random true position in a boolean[][] that is not in a specific rectangle
// map can use [y][x] indexing and the names will make sense here,
// or [x][y] indexing and it will work but be named oddly and the
// Vector2 returned will be using (y, x) order.
public static Vector2 selectRandom(boolean[][] map, Random random, int xMinVisible, int xMaxVisible, int yMinVisible, int yMaxVisible)
{
int ct = 0, height = map.length, width = map[0].length;
int[] rowCounts = new int[height];
for(int y = 0; y < height; y++)
{
if(y >= yMinVisible && y <= yMaxVisible)
@tommyettinger
tommyettinger / Ertah_120x75.txt
Created September 26, 2016 19:36
Revised worldgen algorithm using SpillWorldMap from SquidLib
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~L~~LL~~LL~~~~~~~~~~~~~~~~~~~~~~~~X~~~~HH~~~~~H~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~LL~LLL~LLLLLL~~~~~~~~~~~~~~~~~~~~~~~XXX~~~nHHH~~HHH~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~LLLLLLLLLLLLLLLL~~~~~~~~~~~~~~~~X~XXXXXXXX~nnHHHHHHH~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~LLLLLLLLLLLLLLLLL~~~~~~~~~~~~~~~XXXXXXXXXXXnnnHHHHHHH~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~LLLLLLLLLLLLLLLLLLL~~~~~~~~~~~~~XXXXXXXXXXXXnnnHHHHHHH~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~LLLLLLLLLLLLLLLLL~~~~~~~~~~~~~~~XXXXXXXXXXXnnnHHHHHHHH~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@tommyettinger
tommyettinger / SerializationComparison.txt
Created September 24, 2016 07:16
Comparing old serialization of one of SquidLib's FakeLanguageGen objects to the new way.
Compressed (as Unicode codepoints) with new serialization (valid UTF-16 but LZ-String encoded)
1BE3 2C37 01D5 40E6 01D0 21A1 4EAB 00E4 0348 0300 0D20 6F15 404B 4073 1828 03D0
0E88 3E6B 442B 7037 27C4 1836 26B6 3C29 1620 0674 00AC 00EC 003C 004C 010C 5121
2CE2 5284 662D 0826 6029 617C 17E0 007C 203D 0FA0 1FC0 4046 36B9 03A7 23D7 043A
36E0 068F 67C4 7EB0 0020 0020
54 characters
Uncompressed with new serialization
@tommyettinger
tommyettinger / Ertah_40factions_120x75.txt
Created September 16, 2016 06:32
Sample world maps generated by randomized floodfill, with random-language atlases for nations
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aaa~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~aaa~~a~~~aaaaaa~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~ee~~~~~~~~aaaaaaaaaaaaaaaaa~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~A~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~ee~eee~~~~~~~~~aaaaaaaaaaaaaaaaa~~~~~~~~~~~~~~~~~~~~~~~MMMM~~~~~~~~~~~~~~~~U~AAA~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~eeeee~~~~~~~~~aaGGaaaaaaaaaaaaaa~~~~~~~~~~~~~~~~~~~~~~~MMMM~~~~~~~~~~~~~~~UUUAAAA~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~eeeeee~~~~~~~~~aGGGGGGaGGGaaaaaa~~~~~~~~~~~~~~~~~~~
@tommyettinger
tommyettinger / Ertah_40factions_120x75.txt
Last active September 13, 2016 05:51
World maps with procedural nation names and political boundaries, made by SquidLib
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Q~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~%~~%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~QQ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~%%%%%%~~~~~~~~~~~~~~~~Q~~~QQ~~~~QQQQTTT~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~%%%%%%%%%%~~~~~~~~~~~~~~QQQQQQQQQ~QQQQTTTTTT~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~%%%%%%%%%%~~~~~~~~~~~~~~QQQQQQQQQQQQQQTTTT
@tommyettinger
tommyettinger / roundtrip.java
Created August 27, 2016 02:29
From a fast RNG's Java source code, to hard-to-edit nonsense in multiple scripts, and then back to identical Java code.
/* Written in 2016 by David Blackman and Sebastiano Vigna (vigna@acm.org)
To the extent possible under law, the author has dedicated all copyright
and related and neighboring rights to this software to the public domain
worldwide. This software is distributed without any warranty.
See <http://creativecommons.org/publicdomain/zero/1.0/>. */
package sarong.rng;
import sarong.util.StringKit;
@tommyettinger
tommyettinger / roundtrip.json
Created August 26, 2016 21:36
Round-Trip from JSON, to very-hard-to-edit JSON, and back again.
{"widget": {
"debug": "on",
"window": {
"title": "Sample Konfabulator Widget",
"name": "main_window",
"width": 500,
"height": 500
},
"image": {
"src": "Images/Sun.png",
@tommyettinger
tommyettinger / DetailedMimicOutput3.txt
Created June 10, 2016 03:50
Even more DetailedMimic output.
┌───────────┬───────┐ ┌─────┬───────┬───────────────┐ ┌─────────────┬───────┬───┐
│ . . . . . │ . . . ├───┤ . . │ . . . │ . . . . . . . ├─────────────────┤ . . . . . . │ . . . │ . │
│ . . . │ . │ . . . │ . └───┬─┤ . . . │ . . . . . . . │ . . . . . . . . │ . . . . . . . . . . . . │
├───┬───┴───┤ . . . . . . . └─┼───────┤ . . . . ##. . │ . . . . . . . . . . . . . . . │ . . . │ . │
│ . ├───────┤ . . . . . . . . │ ┌───┐ │ . . . . . . . └───. ──┬───────────────────────┤ . . . ├───┘
│ . │ . . . └─┬─┬─────. . . . │ │ . ├─┘ . ##. ──┐ . . . . . . └───┐ ┌─────┬─────────┘ . . . └───┐
│ . │ . . . . │ │ . . . . . . │ │ . │ . . . . . │ . . . . . . . . │ │ . . │ . . . . . . . . . . │
│ . │ . . . . │ │ . . . . . . │ │ . │ . ┌─────┬─┤ . . . . . . │ . │ │ . . │ . . . . ┌───────┐ . │
│ . . . . . . │ │ . . . . . . │ │ . ├───┤ . . │ │ . . . . . . ├───┴─┐ │ . . ├───┬─────┴───────┘ . │
│ . │ . . . . ├─┘ . ──┬─┐ . . │ │ . ├───┘ . . ├─┴─────. ──────┘ . . ├─┴─┬───┘ │ . . . . . . . . │
@tommyettinger
tommyettinger / DetailedMimicOutput2.txt
Created June 10, 2016 03:44
More DetailedMimic output.
┌───────────┬───────┐ ┌─────┬───────┬───────────────┐ ┌─────────────┬───────┬───┐
│ . . . . . │ . . . ├───┤ . . │ . . . │ . . . . . . . ├─────────────────┤ . . . . . . │ . . . │ . │
│ . . . │ . │ . . . │ . └───┬─┤ . . . │ . . . . . . . │ . . . . . . . . │ . . . . . . . . . . . . │
├───┬───┴───┤ . . . . . . . └─┼───────┤ . . . . ##. . │ . . . . . . . . . . . . . . . │ . . . │ . │
│ . ├───────┤ . . . . . . . . │ ┌───┐ │ . . . . . . . └───. ──┬───────────────────────┤ . . . ├───┘
│ . │ . . . └─┬─┬─────. . . . │ │ . ├─┘ . ##. ──┐ . . . . . . └───┐ ┌─────┬─────────┘ . . . └───┐
│ . │ . . . . │ │ . . . . . . │ │ . │ . . . . . │ . . . . . . . . │ │ . . │ . . . . . . . . . . │
│ . │ . . . . │ │ . . . . . . │ │ . │ . ┌─────┬─┤ . . . . . . │ . │ │ . . │ . . . . ┌───────┐ . │
│ . . . . . . │ │ . . . . . . │ │ . ├───┤ . . │ │ . . . . . . ├───┴─┐ │ . . ├───┬─────┴───────┘ . │
│ . │ . . . . ├─┘ . ──┬─┐ . . │ │ . ├───┘ . . ├─┴─────. ──────┘ . . ├─┴─┬───┘ │ . . . . . . . . │
@tommyettinger
tommyettinger / DetailedMimicOutput.txt
Created June 9, 2016 08:32
A dungeon considered the target style, then after that are increasing-in-size dungeons produced by sampling the properties of the first dungeon with DetailedMimic.
┌─────────────┐ ┌───────────────────┐
│ . . . . . . └─┐ ┌───┬───┐ ┌───┐ ┌───┘ . . . . . . . . . │
│ . . . . ##. . │ ┌─┘ . │ . └─┐ ┌─┘ . └─┬─┘ . . . . . ##. . . . . │
│ . │ . . . │ . └───┐ │ . . . . . │ │ . . . │ . . │ . . . . . │ . . ┌─┘
│ . │ . │ . │ . . . └───┐ │ . . ##. . │ ┌─┘ . │ . . . ──┴───. . ┌───┴─┐ . │
│ . │ . │ . . . . . . , └─┐ ┌─┘ . . . . . │ ┌─┘ . . └─────. . . . . ┌─┘ │ . │
│ . │ . ├─┬───. . . . , ~ │ ┌─┘ . . . . . ┌─┘ ┌─┘ . . . . . . . . ┌─────┘ ┌───┘ . └─┐
│ . │ . │ │ . . . . " ~ ~ │ ┌─┘ . . . . . ┌─┴─────────┬─┘ . . . . ┌─┐ . ┌───┘ │ . . . . │
│ . │ . └─┘ . ┌───┐ " ~ ──┴───┘ . . . . . . │ . " " " " │ . . . . . │ └───┘ ┌───┬─┘ . ┌─┐ . │
│ . . . . . . │ │ " " . . . . . . . . . . . . . . . . . . . ##. ──┤ ┌───┘ . │ . . ├─┘ . │