Skip to content

Instantly share code, notes, and snippets.

@Brian61
Brian61 / RLConsoleStack.cs
Created March 14, 2016 12:32
OpenTk(OpenGL) console stack (3 files) with test program at bottom.
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Graphics.OpenGL;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
namespace RLConsole
@Brian61
Brian61 / scheduler.py
Last active March 1, 2016 00:20
Actor action time scheduler
# scheduler.py - scheduling entity actions
import collections
import numbers
class Scheduler(object):
"""
Schedule entity actions
"""
def __init__(self, actors, start_time=0):
@Brian61
Brian61 / DataSet.cs
Created February 13, 2016 15:34
Data management for roguelike games using a (more or less) RDBM in code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using System.Security.Permissions;
@Brian61
Brian61 / fov_cached.py
Created February 12, 2016 18:21
Fully symmetric partial supercover cached field of view calculation
# field of view quadrant cache
# uses brute force O(N^3) calculation of fov and caches results
import cython
from bitarray import bitarray
from pygame import Rect
from .geometry import generate_partial_supercover_line, generate_points_in_rect_xy, Coordinate
def _gen_quadrant_adjusted(x0, y0, q1x, q1y):
@Brian61
Brian61 / workers.go
Created March 19, 2015 09:40
worker control for long lived goroutine nodes
package workers
// Commands commands for workers (extensible)
type Commands int
// Command types
const (
CommandNone Commands = iota
CommandReset
CommandStart
@Brian61
Brian61 / bomdetect.d
Created March 1, 2015 02:37
BOM detection in D
module bomdetect;
import std.range;
import std.traits;
import std.array;
private enum size_t BOM_BYTES_MAX = 4;
enum BOM : int {
NONE = -1,