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 / StartOnFirstThreadHelper.java
Created April 26, 2023 04:17
-XstartOnFirstThread (Magic)
/*
* Copyright 2020 damios
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@tommyettinger
tommyettinger / DeepMap.txt
Created January 1, 2021 22:28
Multi-layer dungeon map; '<' and '>' are staircases
--------------------------------------------------- depth 0
┌───┐┌────┐ ┌─┐ ┌────┐
┌┘.""└┘....└┐ ┌┘.└┐ ┌┘....└┐
┌┘...""...#..│┌────────┐ ┌┘...└┐│..#...└──┐
│............└┘.,~~~~,.└──┐ │.....││.........└┐
└┐..............───~~.....└┐ └┐...─┴┘...│..┌┐..│ ┌─┐
│...............,,~~......│ │.........│..└┘..└─┬────┘.└┐
├─.────.........,.┌┐......│ └┐.┌──┐...└─.......│.......└┐
│................┌┘│.....┌┘ └─┘ │.....................│
└┐.┌──┐.┌┐....┌──┴┐├─..┌─┴┐ │...┌──┐.............┌┘
@tommyettinger
tommyettinger / Probit.java
Created August 13, 2020 23:49
Probit function in Java
/**
* Provides a {@link #probit(double)} method to convert from the (0.0,1.0) domain to a Gaussian range.
* Uses an algorithm by Peter John Acklam, as implemented by Sherali Karimov.
* Free to use, but you should credit Acklam and Karimov appropriately.
*/
public final class Probit {
private static final double LOW = 0.02425;
private static final double HIGH = 1.0 - LOW;
// Coefficients in rational approximations.
@tommyettinger
tommyettinger / Serpent_Dungeon_Map.txt
Created July 24, 2020 02:09
SerpentMapGenerator output
┌─────────────────────────────────────┐ ┌───────┐ ┌───────────────┐
│ . . . . . . . . . . . . . . . . . . └─┐ │ . . . │ │ . . . . . . . │
┌───┐ │ . . . . . . . . . . . . . . . . . . . ├───┐ │ . . . │ └─┐ . . . . . ┌─┘
┌─┘ . └─┐ └───┬───. . . . . . . . . . . . . . . . │ . └─┐ │ . . . │ │ . . . . . │
│ . . . └─┐ ┌───────────────┐ │ . . . . . . . . . ──────. . . . . . . . └─┐ │ . . . │ ┌───┼─┐ . . . ┌─┘
│ . . . . │ │ . . . . . . . │ │ . . . . . . . . . . . . . . . . . . . . . │ │ . . . └─┘ . └─┴─┐ . ┌─┘
│ . . . . └───────┐ │ . . . . . . . ├───┘ . . . . . . . . . ┌───┐ . . . . . . . . ┌─┘ │ . . . . . . . . │ . │
├───. . . . . . . └─┐ │ .
@tommyettinger
tommyettinger / LessOpenedMaze.txt
Last active June 25, 2020 06:07
Output of an arena-type map generator, with info below each map
Less Opened Maze Generator
┌───────────────────┬───────┐
│...................│.......│
│.................┌─┘.│.┌──.│
│.....│...........│...│.│...│
├─..┌─┴───┐...│.┌─..┌─┘.│.──┤
│...│.....│...│.│...│...│...│
│...│.┌─..└──.│.│.│.└──.├──.│
│...│.│.......│.│.│.....│...│
│..─┤.├──....─┴─┘.└──...│.│.│
@tommyettinger
tommyettinger / IndexedDictionary.cs
Created March 1, 2020 03:38
C# insertion-ordered Dictionary that allows lookup by index.
using System;
using System.Collections;
using System.Collections.Generic;
namespace SquidLib.SquidMath {
/// <summary>
/// Only for use with indexers in IndexedDictionary to show you want to access a key.
/// There is only one enum constant here, At.
/// </summary>
public enum Key {
@tommyettinger
tommyettinger / LanguageOutput.txt
Created February 20, 2020 01:45
Output of FakeLanguageGen from SquidLib
Imitating language: "Lovecraft":
Ku ushku urk tachtal ith zvra...
Hmaanga teik ekhel oguts ape irk.
Ekhi; thi is ialaagh ogiltaats gleputs?
Aagrets nen nyeigh yeltaa!
Aarl ta; aha'at, sain zvrirkai-aikhug lia'aas!
Sol gukh emraats nyamre-op uxo tark fto.
Ux opits uvru as, en'yeh, pe-ialteish piakre.
@tommyettinger
tommyettinger / FloatArray_1_Before.java
Created February 14, 2020 21:47
libGDX's FloatArray before and after running libGDX's Eclipse formatter on it, in IntelliJ.
/*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@tommyettinger
tommyettinger / FOV.java
Created September 12, 2019 05:59
Stripped-down version of Jagd's Field of View class
import java.util.Arrays;
/**
* This class provides methods for calculating Field of View in grids. Field of
* View (FOV) algorithms determine how much area surrounding a point can be
* seen. They return a two dimensional array of doubles, representing the amount
* of view (almost always sight) which the origin has of each cell.
* <br>
* The input resistanceMap is considered the percent of opacity. This resistance
* is on top of the resistance applied from the light spreading out. You can
@tommyettinger
tommyettinger / dungeon1000x1000.txt
Created August 5, 2019 19:34
1000x1000 DUNGEON
This file has been truncated, but you can view the full file.
┌────┐┌──┐┌──────┐ ┌──┐ ┌───────┐┌─────┬───┐ ┌────────┐ ┌──┐ ┌──────────┐ ┌──┐ ┌──────┬─────┐┌──┐ ┌──┐ ┌─────┐ ┌──┐ ┌──┐ ┌──┐┌──────┐ ┌──────┬─────┐┌──┐ ┌──┐ ┌────────┬───────┐ ┌──────┐ ┌────────┐┌──────┐ ┌──┐ ┌──────┐ ┌──┐ ┌──────────┐ ┌──┬─────┐ ┌──┐ ┌─────┐ ┌─────┐ ┌────────┐┌───────────┐┌─────┐ ┌────┬──┐┌────────┐ ┌──────┬─────────┐ ┌───┬───┐┌──┬─────┐ ┌──────┬─────────┐ ┌────────┐ ┌─────┐ ┌───────────┬─────┐ ┌─────┬──┐┌──────┐ ┌───────┬─────┬───┐ ┌─────┐ ┌───┐ ┌──────────────────┐ ┌──┐ ┌──┐ ┌──┐ ┌──────────┐ ┌────────┐ ┌────┐ ┌──┐ ┌──┐ ┌────────┐ ┌───┐ ┌───────────┬─────┐ ┌─────┐ ┌────────┐ ┌──────┐ ┌──┐ ┌─────┬──┐┌────────┐┌────┐ ┌──────┐┌────────┐┌────────┐ ┌──────┐ ┌──┐ ┌──┐ ┌──┐ ┌──────┐ ┌──┐ ┌───┐ ┌─────┐ ┌──┐ ┌────┬────┐ ┌───┬─────┐ ┌─────┐┌─────┬────────────┬───┬─────┐┌──────┐