This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void sortCorners() { | |
//corner1 and corner2 are Vec3is. corner1 is the bottom left corner of the AABB, corner2 is the top right corner. | |
int corner1X = corner1.x; | |
int corner2X = corner2.x; | |
if (corner1X > corner2X) { | |
corner1.x = corner2X; | |
corner2.x = corner1X; | |
} | |
int corner1Y = corner1.y; | |
int corner2Y = corner2.y; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CellularAutonoma { | |
public static void main(String[] args) { | |
boolean[] cells = parseCells(args[0]); | |
for (int age = 0; age < 25; age++) { | |
printCells(cells); | |
cells = tickCells(cells); | |
} | |
printCells(cells); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
public class Extractor { | |
public static void main(String[] args) { | |
if (args.length != 2) { | |
System.out.println("Specify a file and output dir!"); | |
} else { | |
File in = new File(args[0]); | |
File out = new File(args[1]); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
AUTHOR: Dev_Richard (https://www.spigotmc.org/members/dev_richard.38792/) | |
DESC: A simple and easy to use class that can get and set a player's total experience points. | |
Feel free to use this class in both public and private plugins, however if you release your | |
plugin please link to this gist publicly so that others can contribute and benefit from it. | |
Source available at https://gist.github.com/warriordog/6160a1ed45134265fb30b8d224da0426 | |
*/ | |
import org.bukkit.entity.Player; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { parseInputFile } = require('../utils/parser'); | |
// parse input file into array of numbers | |
const inputNumbers = parseInputFile('day9-input.txt', /^(\d+)$/gm) | |
.map(([_, num]) => parseInt(num)) | |
; | |
/** | |
* Finds the minimum and maximum values of all the numbers in {@link inputNumbers} between indexes start and end. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { parseInputFile } = require('../utils/parser'); | |
// parse input file into array of numbers | |
const inputNumbers = parseInputFile('day10-input.txt', /^(\d+)$/gm) | |
.map(([_, num]) => parseInt(num)) | |
.sort((a, b) => a - b) // JS uses an alaphabetic sort by default, even for numbers | |
; | |
/** | |
* @typedef Adapter A charging adapter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { parseInputFile } = require('../utils/parser'); | |
class Queue { | |
constructor() { | |
this.head = null; | |
this.tail = null; | |
} | |
push(value) { | |
const node = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { parseInputFile } = require('../utils/parser'); | |
/** | |
* @readonly | |
* @enum {number} | |
*/ | |
const Seat = { | |
FLOOR: 0, | |
EMPTY: 1, | |
TAKEN: 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { parseInputFile } = require('../utils/parser'); | |
/** | |
* @readonly | |
* @enum {number} | |
*/ | |
const Seat = { | |
FLOOR: 0, | |
EMPTY: 1, | |
TAKEN: 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { parseInputFile } = require('../utils/parser'); | |
const Dir = { | |
NORTH: 0, | |
EAST: 90, | |
SOUTH: 180, | |
WEST: 270 | |
}; | |
const inputSteps = parseInputFile('day12-input.txt', /^(\w)(\d+)$/gm) |
OlderNewer