Skip to content

Instantly share code, notes, and snippets.

View MHeasell's full-sized avatar

Michael Heasell MHeasell

View GitHub Profile
@MHeasell
MHeasell / bins.js
Created April 8, 2015 22:15
My CodeCombat Zero Sum tournament entry source code. Check out https://gist.github.com/MHeasell/bb9f7253da45b5140a83 for the compiled version and http://michaelheasell.com/blog/2015/04/08/zero-sum-my-winning-strategy/ for a full write-up about my strategy.
// bin stuff -------------------------------------------------------------------
const BIN_WIDTH = 13.333333333333;
const HALF_BIN_WIDTH = (BIN_WIDTH / 2);
const BIN_HEIGHT = 14;
const HALF_BIN_HEIGHT = (BIN_HEIGHT / 2);
const NUM_BINS_X = 6;
const NUM_BINS_Y = 5;
@MHeasell
MHeasell / zero-sum.js
Created April 15, 2015 09:53
My CodeCombat Zero Sum tournament entry, compiled version. Check out https://gist.github.com/MHeasell/e7ddb00a279d141d03fd for the source code and http://michaelheasell.com/blog/2015/04/08/zero-sum-my-winning-strategy/ for my strategy write-up.
function vecAdd(a, b) {
return {
x: a.x + b.x,
y: a.y + b.y
};
}
function vecSub(a, b) {
return {
x: a.x - b.x,
y: a.y - b.y