This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
// Policy: | |
// - Keep zombies away from humans | |
// - Cluster zombies | |
// - Kill all at once | |
/** | |
* Save humans, destroy zombies! | |
**/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
. ~/.nvm/nvm.sh | |
npm install uglify-js | |
wget "https://code.jquery.com/jquery-2.1.4.js" -Ojquery.js | |
nvm install 0.10 | |
time node node_modules/.bin/uglifyjs jquery.js > jquery.min.js | |
nvm install 0.12 | |
time node node_modules/.bin/uglifyjs jquery.js > jquery.min.js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/extensions/tools/commands/creepClone.js b/extensions/tools/commands/creepClone.js | |
index 3a02c7f..908da15 100644 | |
--- a/extensions/tools/commands/creepClone.js | |
+++ b/extensions/tools/commands/creepClone.js | |
@@ -7,11 +7,11 @@ var duplicateCreep = function (creep, priority, silence) { | |
silence = silence === true; | |
// Find and add to queue | |
- if (typeof creep.memory.spawn === "string") { | |
- spawn = Game.getObjectById(creep.memory.spawn).name; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function duplicate(value, count) { | |
var output = []; | |
var duplicator = [value]; | |
var base = 1; | |
while (count > 0) { | |
if ((base & count) > 0) { | |
output = output.concat(duplicator); | |
count -= base; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
var https = require("https"); | |
var querystring = require("querystring"); | |
// Display help if necessary | |
if ((process.argv[2] === "--help" || process.argv[2] === undefined) && process.argv[3] === undefined) { | |
console.log("Usage: " + process.argv[0] + " " + process.argv[1] + " <email> <password> [branch=default]"); | |
process.exit(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var writeApiData = function() { | |
var parseFunction = function(obj) { | |
// Note: Function.prototype.toString() is implementation defined, may not work on non-v8 or future v8 js engines | |
// See: http://www.ecma-international.org/ecma-262/5.1/#sec-15.3.4.2 | |
var args = obj.toString(); | |
args = args.substr(0, args.indexOf(")")); | |
args = args.substr(args.indexOf("(") + 1); | |
args = args === "" ? [] : args.split(","); | |
var data = { | |
"_type": "function", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
// TODO use high performance array? | |
var types = { | |
plain: 0, | |
swamp: 1, | |
lava: 2, | |
wall: 3 | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
function hasWall(list, returnValueDefaultsTrue) { | |
if (!Array.isArray(list)) { | |
return returnValueDefaultsTrue === undefined ? true : returnValueDefaultsTrue; | |
} | |
for (var i = 0; i < list.length; i++) { | |
if (list[i].type === "terrain" && list[i].terrain === "wall") { | |
return true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Priority stack implementation over here https://github.com/avdg/screeps/blob/master/extensions/tools/library/priorityStack.js | |
// Assume AI.priorityStack = require(<path to priorityQueue>); | |
/** | |
* A basic huffman tree compression algorithm | |
* | |
* @param input String Input to convert | |
* | |
* @return string | |
*/ |