Skip to content

Instantly share code, notes, and snippets.

@AlinaNova21
AlinaNova21 / findAttack.js
Created September 14, 2016 04:45
Screeps Invader Source Code
var flee = require('flee');
function checkPath(pos1, pos2) {
var path = pos1.findPathTo(pos2);
if (!path.length) {
return false;
}
return path[path.length - 1].x == pos2.x && path[path.length - 1].y == pos2.y;
}
function costCallbackIgnoreRamparts(roomName, cm) {
var ramparts = Game.rooms[roomName].find(FIND_STRUCTURES, {filter: i => i.structureType == STRUCTURE_RAMPART || i.structureType == STRUCTURE_WALL});
@dzhu
dzhu / screeps.py
Last active November 14, 2020 10:18
description of the HTTP endpoints available from Screeps, and a Python wrapper to access them (requires requests library)
import json
from base64 import b64decode
from collections import OrderedDict
from cStringIO import StringIO
from gzip import GzipFile
import requests
## Python before 2.7.10 or so has somewhat broken SSL support that throws a warning; suppress it
@palexander
palexander / gist:2975305
Last active January 21, 2022 14:03
Compiling and running mosh on Dreamhost
# Thanks to @samsonjs for the cleaned up version:
# https://gist.github.com/samsonjs/4076746
PREFIX=$HOME
VERSION=1.2.3
# Install Protocol Buffers
wget http://protobuf.googlecode.com/files/protobuf-2.4.1.tar.bz2
tar -xf protobuf-2.4.1.tar.bz2
cd protobuf-2.4.1