Skip to content

Instantly share code, notes, and snippets.

Reddit Privacy Policy
Effective October 15, 2020. Last Revised September 15, 2020
We've updated our User Agreement and Privacy Policy. Please take a look before the changes take effect on October 15, 2020.
This page is the updated Privacy Policy; for the version effective until October 15, 2020, click here.
We want you to understand how and why Reddit, Inc. (“Reddit,” “we” or “us”) collects, uses, and shares information about you when you use our sites, mobile apps, widgets, and other online products and services (collectively, the "Services") or when you otherwise interact with us or receive a communication from us. This Privacy Policy applies to all of our Services including Reddit Gifts, which maintains a separate privacy notice that incorporates this Privacy Policy by reference.
Reddit Privacy Policy
Effective October 15, 2020. Last Revised September 15, 2020
We've updated our User Agreement and Privacy Policy. Please take a look before the changes take effect on October 15, 2020.
This page is the updated Privacy Policy; for the version effective until October 15, 2020, click here.
We want you to understand how and why Reddit, Inc. (“Reddit,” “we” or “us”) collects, uses, and shares information about you when you use our sites, mobile apps, widgets, and other online products and services (collectively, the "Services") or when you otherwise interact with us or receive a communication from us. This Privacy Policy applies to all of our Services including Reddit Gifts, which maintains a separate privacy notice that incorporates this Privacy Policy by reference.
@bonzaiferroni
bonzaiferroni / TestGarbage.cs
Created October 6, 2018 17:26
Test sources of garbage generation
using System;
using System.Diagnostics;
using System.Reflection;
using System.Text;
using UnityEngine;
namespace Automatika
{
public class TestGarbage : MonoBehaviour
{
@bonzaiferroni
bonzaiferroni / BookmarkModule.ts
Created September 7, 2018 15:34
BotBot example module
import {BotModule, ModuleMemory} from "./BotModule";
import {HelpData} from "./HelpModule";
import {BotMessage} from "../BotMessage";
import {Client, Message, MessageReaction, TextChannel} from "discord.js";
import {EmojiHelper} from "../EmojiHelper";
export class BookmarkModule extends BotModule<BookmarkMemory> {
protected id = "bookmarks";
@bonzaiferroni
bonzaiferroni / TravelerTestStuckDetect.ts
Created June 5, 2017 19:41
The previous method of testing whether a creep has moved vs. new
testCPU() {
const STATE_PREV_X = 0;
const STATE_PREV_Y = 1;
const STATE_STUCK = 2;
const STATE_CPU = 3;
const STATE_DEST_X = 4;
const STATE_DEST_Y = 5;
const STATE_DEST_ROOMNAME = 6;
let newTraveler = Game.creeps["newTraveler"];
@bonzaiferroni
bonzaiferroni / TravelerTestFunctionCall.ts
Created June 5, 2017 19:05
testing "overhead" of managing state objects with function call vs. without
testCPU() {
const STATE_PREV_X = 0;
const STATE_PREV_Y = 1;
const STATE_STUCK = 2;
const STATE_CPU = 3;
const STATE_DEST_X = 4;
const STATE_DEST_Y = 5;
const STATE_DEST_ROOMNAME = 6;
let creep = Game.creeps["newTraveler"];
@bonzaiferroni
bonzaiferroni / TravelerSerializationTest.ts
Created June 2, 2017 21:38
Tests for memory overhead with different traveler objects
testCPU() {
let obj1 = {
_trav: {
stuck: 0,
cpu: 133,
last: { x: 17, y: 29 },
dest: { x: 18, y: 31, roomName: "E22S24" },
path: "42640344898844894894",
},
};
@bonzaiferroni
bonzaiferroni / TravelerSerialization.ts
Created June 2, 2017 17:33
Serialization in Traveler
private deserializeState(travelData: TravelData, destination: RoomPosition): TravelState {
let state = {} as TravelState;
if (travelData.state) {
let parse = travelData.state.split("_");
state.lastCoord = {x: Number.parseInt(parse[STATE_LAST_X]), y: Number.parseInt(parse[STATE_LAST_Y]) };
state.cpu = Number.parseInt(parse[STATE_CPU]);
state.stuckCount = Number.parseInt(parse[STATE_STUCK]);
let destX = Number.parseInt(parse[STATE_DEST_X]);
let destY = Number.parseInt(parse[STATE_DEST_Y]);
let destRoomName = parse[STATE_DEST_ROOMNAME];
@bonzaiferroni
bonzaiferroni / sandbox.ts
Created June 2, 2017 14:19
traveler tests
let travFlag = Game.flags["travFlag"];
if (travFlag) {
let newTraveler = new Traveler();
let oldTraveler = new OldTraveler();
let newTravelerCreep = Game.creeps["newTraveler"];
if (!newTravelerCreep) {
empire.spawnFromClosest(travFlag.pos, [MOVE], "newTraveler");
}
import {MINERALS_RAW, RESERVE_AMOUNT, TradeNetwork, PRODUCT_LIST} from "./TradeNetwork";
export class MarketTrader {
private network: TradeNetwork;
constructor(network: TradeNetwork) {
this.network = network;
}
public actions() {