Skip to content

Instantly share code, notes, and snippets.

@seth10
Created September 25, 2016 20:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seth10/cfeae1a7b294ebe1327ba744d83a53f9 to your computer and use it in GitHub Desktop.
Save seth10/cfeae1a7b294ebe1327ba744d83a53f9 to your computer and use it in GitHub Desktop.
> JSON.stringify(Game.spawns['Arendelle'].pos.findPathTo(Game.spawns['Arendelle'].room.find(FIND_SOURCES)[0]).length)
< 11
> JSON.stringify(Game.spawns['Arendelle'].pos.getRangeTo(Game.spawns['Arendelle'].room.find(FIND_SOURCES)[0]))
< 12
> JSON.stringify(Game.spawns['Arendelle'].pos.getRangeTo(Game.flags['AdjoiningRoomSource']))
< null // should be path to exit
> PathFinder.search(Game.spawns['Arendelle'].pos, Game.flags['AdjoiningRoomSource'].pos).path.length
< 70 // valid, I counted about 68
> PathFinder.search(Game.spawns['Arendelle'].pos, Game.spawns['Arendelle'].room.find(FIND_SOURCES)[0].pos).path.length
< 16 // should be 12
> JSON.stringify(require('calc').calculateOptimalBodyPartSet(Game.spawns['Arendelle'], PathFinder.search(Game.spawns['Arendelle'].pos, Game.spawns['Arendelle'].room.find(FIND_SOURCES)[0].pos).path.length))
< {"efficiency":1.4450867052023122,"work":4,"carry":5,"move":5}
> JSON.stringify(require('calc').calculateOptimalBodyPartSet(Game.spawns['Arendelle'], 12))
< {"efficiency":1.5625,"work":5,"carry":3,"move":5}
> JSON.stringify(require('calc').calculateOptimalBodyPartSet(Game.spawns['Arendelle'], PathFinder.search(Game.spawns['Arendelle'].pos, Game.flags['AdjoiningRoomSource'].pos).path.length))
< {"efficiency":0.7882882882882883,"work":3,"carry":7,"move":5}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment