Skip to content

Instantly share code, notes, and snippets.

View randompast's full-sized avatar

randompast

View GitHub Profile
var a = [1,2,3,4,9,20];
a.lerp = function(n){
var a = this[Math.floor(n)];
//console.log("a: " + a);
var b = this[Math.ceil(n)];
//console.log("b: " + b);
var t = n-Math.floor(n);
//console.log("t: " + t);
return (1-t)*a + t*b;
}
@randompast
randompast / robot.js
Created December 4, 2012 05:58 — forked from cezarsa/robot.js
QR-bot-007
var Robot = function(robot){
robot.turnLeft(robot.angle % 30);
robot.turnGunRight(90);
robot.clone();
this.direction = 1;
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(1);
if (robot.parentId) {
@randompast
randompast / robot.js
Created December 4, 2012 05:54 — forked from fabiopimentel/robot.js
QR-bot-006
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.clone();