This file contains 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
Game.spawns['Spawn1'].spawnCreep( [WORK, CARRY, MOVE], 'Harvester1' ); |
This file contains 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
module.exports.loop = function () { | |
var creep = Game.creeps['Harvester1']; | |
var sources = creep.room.find(FIND_SOURCES); | |
if(creep.harvest(sources[0]) == ERR_NOT_IN_RANGE) { | |
creep.moveTo(sources[0]); | |
} | |
} |
This file contains 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
module.exports.loop = function () { | |
var creep = Game.creeps['Harvester1']; | |
if(creep.store.getFreeCapacity() > 0) { | |
var sources = creep.room.find(FIND_SOURCES); | |
if(creep.harvest(sources[0]) == ERR_NOT_IN_RANGE) { | |
creep.moveTo(sources[0]); | |
} | |
} | |
else { |
This file contains 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
module.exports.loop = function () { | |
for(var name in Game.creeps) { | |
var creep = Game.creeps[name]; | |
if(creep.store.getFreeCapacity() > 0) { | |
var sources = creep.room.find(FIND_SOURCES); | |
if(creep.harvest(sources[0]) == ERR_NOT_IN_RANGE) { | |
creep.moveTo(sources[0]); | |
} | |
} |
This file contains 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 roleHarvester = { | |
/** @param {Creep} creep **/ | |
run: function(creep) { | |
if(creep.store.getFreeCapacity() > 0) { | |
var sources = creep.room.find(FIND_SOURCES); | |
if(creep.harvest(sources[0]) == ERR_NOT_IN_RANGE) { | |
creep.moveTo(sources[0]); | |
} | |
} |
This file contains 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 roleHarvester = require('role.harvester'); | |
module.exports.loop = function () { | |
for(var name in Game.creeps) { | |
var creep = Game.creeps[name]; | |
roleHarvester.run(creep); | |
} | |
} |
This file contains 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 roleHarvester = require('role.harvester'); | |
var roleUpgrader = require('role.upgrader'); | |
module.exports.loop = function () { | |
for(var name in Game.creeps) { | |
var creep = Game.creeps[name]; | |
if(creep.memory.role == 'harvester') { | |
roleHarvester.run(creep); | |
} |
This file contains 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
psql -U username -W -h hostname -d dbname -f db_dump.sql |
This file contains 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
func FibonacciBinet(n int) int { | |
sqrt5 := math.Sqrt(5) | |
phi := (1 + sqrt5) / 2 | |
return int(math.Round(math.Pow(phi, float64(n)) / sqrt5)) | |
} |
This file contains 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
func FibonacciRecursive(n int) int { | |
if n <= 1 { | |
return n | |
} | |
return FibonacciRecursive(n-1) + FibonacciRecursive(n-2) | |
} |
OlderNewer