Skip to content

Instantly share code, notes, and snippets.

@EliseAv
Last active May 13, 2020 22:30
Show Gist options
  • Save EliseAv/f1a3ae3f48ef94863aa6f31acd0b6d64 to your computer and use it in GitHub Desktop.
Save EliseAv/f1a3ae3f48ef94863aa6f31acd0b6d64 to your computer and use it in GitHub Desktop.
Paperclips Helper
/*
Copyright 2017 Ekevoo
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--
This is a bunch of fragments that I paste into the Javascript console and play as the game progresses.
Most commands are only meant to work in one of the three stages, I did not test at other moments.
Whether this is cheating or not is an interesting thought exercise. The player is an AI, and these
fragments loosely qualify.
*/
// Auto buy & make, for initial game
aoeu = (function() {
var id = null;
return function() {
if (id) {
clearInterval(id);
id = null;
return 'Auto buy & make disabled';
} else {
id = setInterval(function(){
if (wire)
clipClick(wire);
if (funds >= wireCost)
buyWire();
}, 100);
return 'Auto buy & make enabled';
}
}
})();
// Only auto make, to allow room for marketing & other purchases
aoeu = (function() {
var id = null;
return function() {
if (id) {
clearInterval(id);
id = null;
return 'Auto make disabled';
} else {
id = setInterval(function(){
if (wire)
clipClick(wire);
}, 10);
return 'Auto make enabled';
}
}
})();
// Buy spoll only when few unsold clips
aoeuUnsold = (function() {
var id = null;
return function() {
if (id) {
clearInterval(id);
id = null;
return 'Auto buy wire disabled';
} else {
id = setInterval(function(){
if (unsoldClips < avgSales)
buyWire();
}, 10);
return 'Auto buy wire enabled';
}
}
})();
// Investments toggle
aoeuInv = (function() {
var deposit = null, withdraw = null;
return function(neither) {
if (neither) {
clearInterval(deposit);
clearInterval(withdraw);
deposit = withdraw = null;
return 'Disabed auto invest';
} else if (deposit) {
clearInterval(deposit);
deposit = null;
withdraw = setInterval(function() {
if (bankroll) investWithdraw();
}, 100);
return 'Auto withdrawing. ' + withdraw;
} else {
clearInterval(withdraw);
withdraw = null;
deposit = setInterval(investDeposit, 5000);
return 'Auto depositing. ' + deposit;
}
}
})();
// QUANTUM COMPUTING
aoeuQuantum = setInterval(function() {
var sum = 0;
for (var chip of qChips)
if (chip.active)
sum += chip.value;
if (sum > 0)
qComp();
}, 10);
// Auto Tourney (before actual auto tourney)
aoeuTourney = (function() {
var btn = $('#btnNewTournament');
var id = setInterval(checkTourney, 500);
console.log('auto tourney running');
return stopAutoTourney;
function checkTourney() {
if (!btn.disabled) {
newTourney();
runTourney();
}
}
function stopAutoTourney() {
clearInterval(id);
return 'auto tourney stopped';
}
})();
// Auto solar farms & batteries
aoeuSolar = (function() {
var id = setInterval(calcAndBuy, 100);
return function() {
clearInterval(id);
return 'auto solar farm disabled';
};
function calcAndBuy() {
var supply = farmLevel * farmRate;
var dDemand = (harvesterLevel * dronePowerRate) + (wireDroneLevel * dronePowerRate);
var fDemand = (factoryLevel * factoryPowerRate);
var demand = dDemand + fDemand;
var gottaBuy = (demand * 1.1 - supply) / farmRate;
while (gottaBuy > 0 && farmCost <= unusedClips) {
makeFarm(1);
gottaBuy--;
}
while (batteryLevel < 1000 && batteryLevel < farmLevel && batteryCost <= unusedClips) {
makeBattery(1);
}
// make sure drone ratio makes sense
var targetHarvester = Math.floor(wireDroneLevel * wireDroneRate / harvesterRate);
if (targetHarvester > harvesterLevel) {
makeHarvester(targetHarvester - harvesterLevel);
} else if (targetHarvester < harvesterLevel) {
var targetWireDrone = Math.ceil(harvesterLevel * harvesterRate / wireDroneRate);
makeWireDrone(targetWireDrone - wireDroneLevel);
}
}
})();
// Take swarm gifts at 1:1
aoeuGifts=setInterval(function(){
if (swarmGifts) {
if (processors<memory) addProc();
else addMem();
}
},10);
// Late Earth Takeover - buy clip factories, take swarm gifts
aoeu=setInterval(function(){
if (swarmGifts) {
if (processors<memory) addProc();
else addMem();
}
if (factoryCost<=unusedClips) makeFactory();
},500)
// Probe launch and yomi consumption (space exploration)
aoeuProbe=(function(){
var hotId = setInterval(launchSomeProbes, 10);
var warmId = setInterval(probeDesign, 100);
return function() {
clearInterval(hotId);
clearInterval(warmId);
return 'stopped auto probe';
};
function launchSomeProbes() {
if (probeLaunchLevel < 10000)
makeProbe();
else {
console.log('10k probes launched!');
clearInterval(hotId);
}
}
function probeDesign() {
while (yomi >= probeTrustCost && probeTrust < maxTrust)
increaseProbeTrust();
}
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment