Skip to content

Instantly share code, notes, and snippets.

View Phalanxia's full-sized avatar
🍕
Developing Games

Madison Phalanxia

🍕
Developing Games
View GitHub Profile
@RobertSzkutak
RobertSzkutak / ircecho.py
Created October 30, 2011 21:15
Echo, a simple IRC bot written in Python 3
#!/usr/bin/env python3
# ircecho.py
# Copyright (C) 2011 : Robert L Szkutak II - http://robertszkutak.com
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
@begla
begla / gist:1019993
Created June 10, 2011 23:13
Linear, bilinear and trilinear interpolation
public static float lerp(float x, float x1, float x2, float q00, float q01) {
return ((x2 - x) / (x2 - x1)) * q00 + ((x - x1) / (x2 - x1)) * q01;
}
public static float biLerp(float x, float y, float q11, float q12, float q21, float q22, float x1, float x2, float y1, float y2) {
float r1 = lerp(x, x1, x2, q11, q21);
float r2 = lerp(x, x1, x2, q12, q22);
return lerp(y, y1, y2, r1, r2);
}
@banksean
banksean / perlin-noise-classical.js
Created February 15, 2010 10:00
two Perlin noise generators in javascript. The simplex version is about 10% faster (in Chrome at least, haven't tried other browsers)
// Ported from Stefan Gustavson's java implementation
// http://staffwww.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf
// Read Stefan's excellent paper for details on how this code works.
//
// Sean McCullough banksean@gmail.com
/**
* You can pass in a random number generator object if you like.
* It is assumed to have a random() method.
*/