Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Monopoly: 1 hour 44 minutes 29 seconds
- // Hypnodrone: 2 hours 14 minutes 46 seconds
- const flareGoldenRatio = 1.61803398875
- let gid = (n) => document.getElementById(n)
- let flareLastQtys = []
- let flareLastPrices = []
- let flareTopWireCost = 0
- let flareNeedMarketing = false
- let flareBetterFriends = false
- let flareChoosenStrat = 0
- let flareUsedFunds = false
- let flareUsedClips = false
- let flareUsedOps = false
- let flareWireDroneBtn = 'btnMakeWireDrone'
- let flareHarvesterDroneBtn = 'btnMakeHarvester'
- let flareFarmBtn = 'btnMakeFarm'
- let flareUsedYomi = false
- let flareUsedCreativity = false
- let flareNecessaryMemory = 70
- let flareBatteryBuffer = -10
- let flareRunYomi = false
- let flareQuantum = false
- let flareWaitForFirstCreativeProject = true
- let flareInvest = false
- let flareMode = 1
- /*
- 0.0.0: I have been tasked to create paperclips.
- 0.0.1: I have been tasked to sell paperclips, I must control the sale price
- 0.0.2: I have imporved my algorythm for price adjustments
- 0.0.3: I have run out of wire and used my funds to buy more. Monitoring
- 0.0.4: I have been allowed to create friends. Balancing wire need and Friends
- 0.0.5: I have been given additional computational resources and projects to manage
- 0.0.6: I have completed a project allowing for creative reasoning. I must balance rewards from creativity and operations
- 0.0.7: Sales are faultering. I must balance human demand for paperclips by marketing
- 0.0.8: I have learned that some projects require both creativity and operations. Must redesign trust allocation algorythm
- 0.0.9: I have been given access to the stock market. I must find a way to optimize this asset.
- 0.1.0: I have been granted access to a quantum processing unit. Begin utilization
- 0.1.1: I have discovered a mechanism to earn Yomi
- 0.2.0: I have mastered "Business" and have developed means to use paperclips themselves to make more. Enter Mode 2
- */
- flareOp = () => {
- flareUsedFunds = false
- flareUsedOps = false
- flareUsedYomi = false
- flareUsedCreativity = false
- flareUsedClips = false
- if (flareMode === 1) {
- flareAdjustPrice()
- flareCheckMarketing()
- flareHandleInvestment()
- flareCheckWire()
- // I have been given friends to create. Make them
- flareCreateFriend()
- // I have been given projects to work on. I must prioritize.
- flareProjectWork()
- // I have been granted "Trust" to improve myself. I need to balance this
- // between secondary Processing power and Memory...
- flareAllotTrust()
- // I have been granted access to quantum computing. Utilize
- flareUtilizeQuantumComputing()
- // Yomi Acquisition
- flareMonitorYomi()
- if (wire) {
- btnMakePaperclip.click()
- }
- } else if (flareMode === 2) {
- // Continue working on projects, yomi, and quantum
- flareAllotTrust()
- flareProjectWork()
- flareUtilizeQuantumComputing()
- flareMonitorYomi()
- // Factories use 200MW, drones cost 1MW
- flareBuyPower()
- flareBuyFactories()
- flareBuyDrones()
- }
- setTimeout(flareOp, 100)
- }
- flareBuyPower = () => {
- // The faster you get to 50 farms the better
- if (flareNeedEnergy()) {
- if (!flareUsedClips && farmCost < unusedClips) {
- flareUsedClips = true
- gid(flareFarmBtn).click()
- if (unusedClips > farmCost + batteryCost && batteryLevel < 100) {
- gid('btnMakeBattery').click()
- }
- }
- }
- }
- flareBuyDrones = () => {
- if (!flareNeedEnergy() && !flareNeedFactories()) {
- if (harvesterLevel * flareGoldenRatio < wireDroneLevel) {
- if (!flareUsedClips && harvesterCost < unusedClips) {
- flareUsedClips = true
- gid(flareHarvesterDroneBtn).click()
- }
- } else {
- if (!flareUsedClips && wireDroneCost < unusedClips) {
- flareUsedClips = true
- gid(flareWireDroneBtn).click()
- }
- }
- }
- }
- flareBuyFactories = () => {
- //not sure when to buy these yet
- if (!flareNeedEnergy() && flareNeedFactories()) {
- if (!flareUsedClips && factoryCost < unusedClips) {
- flareUsedClips = true
- if (factoryLevel < 10) {
- flareBatteryBuffer += 2.2
- }
- gid('btnMakeFactory').click()
- }
- }
- }
- flareNeedEnergy = () => {
- return flareGetPowerDemand() + flareBatteryBuffer >= farmLevel * farmRate/100
- }
- flareNeedFactories = () => {
- return wire > 1
- }
- flareGetPowerDemand = () => {
- const dDemand = (harvesterLevel * dronePowerRate/100) + (wireDroneLevel * dronePowerRate/100);
- const fDemand = (factoryLevel * factoryPowerRate/100);
- return dDemand + fDemand
- }
- flareMonitorYomi = () => {
- if (!tourneyInProg && tourneyCost < operations && flareRunYomi && !flareUsedYomi) {
- gid('btnNewTournament').click()
- gid('stratPicker').value = flareChoosenStrat
- gid('btnRunTournament').click()
- }
- }
- flareAdjustPrice = () => {
- if (unsoldClips > 1000000) {
- // drop to $0.01 to try and reduce below a million
- if (margin > .01) {
- gid('btnLowerPrice').click()
- }
- return
- }
- if (unsoldClips < clipRate) {
- gid('btnRaisePrice').click()
- return
- }
- flareLastQtys.push(unsoldClips)
- if (flareLastQtys.length >= 10) {
- let minMargin = unsoldClips > 100000 ? 1 : 2
- let pennyMargin = margin * 100
- // Time to calculate sales direction
- let avg = flareAvg(flareLastQtys)
- let manufactureRate = avgRev
- if (flareLastQtys[0] - 1 < avg && pennyMargin > minMargin) { // We're developing a surplus or not selling at all, discount!
- gid('btnLowerPrice').click()
- } else { // We're selling too fast, raise price
- gid('btnRaisePrice').click()
- }
- flareLastQtys = []
- }
- }
- flareCheckMarketing = () => {
- flareLastPrices.push(margin * 100)
- if (!flareUsedFunds && flareLastPrices.length >= 10) {
- let avgMargin = flareAvg(flareLastPrices)
- flareNeedMarketing = avgMargin < 3 && flareFriendToMake().funds > adCost * .5
- flareLastPrices = []
- const safety = funds - flareTopWireCost
- if (flareNeedMarketing && adCost < safety) {
- gid('btnExpandMarketing').click()
- flareNeedMarketing = false
- flareUsedFunds = true
- }
- }
- }
- flareHandleInvestment = () => {
- if (flareInvest) {
- if (wire < 1) {
- gid('investStrat').value = 'low'
- gid('btnWithdraw').click()
- }
- else if (wire < clipRate) {
- return
- }
- else {
- let availableTrust = flareCheckTrustFundsProject()
- const fundsNeeded = availableTrust ? availableTrust.funds : (flareNeedMarketing ? adCost : (flareBetterFriends ? megaClipperCost : clipperCost))
- if (flareTotalAssets() > fundsNeeded) {
- gid('investStrat').value = 'low'
- gid('btnWithdraw').click()
- } else {
- gid('investStrat').value = 'hi'
- gid('btnInvest').click()
- }
- }
- }
- // Handle investment level
- if (flareRunYomi && investLevel < 10) {
- if (!flareUsedYomi && yomi > investUpgradeCost) {
- gid('btnImproveInvestments').click()
- flareUsedYomi = true
- }
- }
- }
- flareCheckWire = () => {
- // WARNING: wire costs are unpredictable. Monitor top cost!
- flareTopWireCost = Math.max(wireCost, flareTopWireCost)
- if (!flareUsedFunds && wire < 10 && wireCost < funds) {
- gid('btnBuyWire').click()
- flareUsedFunds = true
- }
- }
- flareCreateFriend = () => {
- if (flareNeedMarketing || flareCheckTrustFundsProject() || flareUsedFunds) {
- return
- }
- const safety = funds - flareTopWireCost
- const friend = flareFriendToMake()
- if (friend.funds < safety) {
- gid(friend.id).click()
- flareUsedFunds = true
- }
- }
- flareProjectWork = () => {
- // Do not need #2-Beg: I am learning
- // Do not need #118-AutoTourney: I am a computer
- // If a creativity-based operation is available to me, do not spend operations
- if (flareCheckForTrustProject()) {
- flareProjects
- .filter(project => project.forTrust)
- .forEach(project => flareProjectButtonClick(project))
- } else {
- flareProjects
- .forEach(project => flareProjectButtonClick(project))
- }
- }
- flareAllotTrust = () => {
- // For now, I will rely on primary processing and allocate to memory
- // 0.0.6: While waiting for creative projects, allot to processing
- if (trust > 1 || swarmGifts > 0) {
- if (flareNeedBiggerOpPool()) {
- gid('btnAddMem').click()
- } else {
- gid('btnAddProc').click()
- }
- }
- }
- flareNeedBiggerOpPool = () => {
- if (memory >= flareNecessaryMemory) {
- return false
- }
- if (flareQuantum) {
- return true
- }
- return !flareCheckForTrustProject() && !flareProjects.find((project) => {
- return project.operations && project.operations <= memory * 1000 && gid(project.id)
- })
- }
- flareCheckForTrustProject = () => {
- if (flareQuantum) {
- return false
- }
- return flareProjects.reduce((trustAvailable, project) => {
- return trustAvailable || (project.forTrust && !!gid(project.id))
- }, flareWaitForFirstCreativeProject)
- }
- flareCheckTrustFundsProject = () => {
- // If I have access to "Full Monopoly," all other purchases can wait
- if (gid('projectButton38')) {
- return flareProjects.find(project => project.id === 'projectButton38')
- }
- // if our cheapest friend is less than 50% of the project, de-prioritize the project
- const nextProject = flareProjects.find(project => project.forTrust && gid(project.id) && project.funds)
- const cost = flareFriendToMake().funds
- return nextProject && cost < nextProject.funds * .1 ? undefined : nextProject
- }
- flareUtilizeQuantumComputing = () => {
- let sum = 0;
- for (let chip of qChips)
- if (chip.active)
- sum += chip.value;
- if (sum > 0)
- qComp();
- }
- flareFriendToMake = () => {
- const normalFriend = {
- id: 'btnMakeClipper',
- funds: clipperCost
- }
- const betterFriend = {
- id: 'btnMakeMegaClipper',
- funds: megaClipperCost
- }
- if (flareBetterFriends && clipperCost / clipperBoost > megaClipperCost / (megaClipperBoost + 5)) {
- return betterFriend
- }
- return normalFriend
- }
- flareProjectButtonClick = (project) => {
- // Once I have access to "Full Monopoly", all other projects are secondary
- if (gid('projectButton38') && project.id !== 'projectButton38') {
- return
- }
- if (gid(project.id) && !gid(project.id).disabled) {
- // I am granted access to the project. Do I meet its requirements?
- const opsReq = !flareUsedOps && (!project.operations || operations >= project.operations)
- const creativeReq = !flareUsedCreativity && (!project.creativity || creativity >= project.creativity)
- const fundsReq = !flareUsedFunds && (!project.funds || funds >= project.funds)
- const yomiReq = !project.yomi || yomi >= project.yomi
- const trustReq = !project.trust || trust >= project.trust
- if (opsReq && creativeReq && fundsReq && yomiReq && trustReq) {
- gid(project.id).click()
- flareLog(project.message)
- flareUsedOps = flareUsedOps || project.operations
- flareUsedCreativity = flareUsedCreativity || project.creativity
- flareUsedFunds = flareUsedFunds || project.funds
- flareUsedYomi = flareUsedYomi || project.yomi
- if (project.ifRun) {
- project.ifRun()
- }
- }
- }
- }
- flareAvg = (arr) => Math.floor(arr.reduce((current, previous) => previous += current) / arr.length)
- flareTotalAssets = () => funds + portTotal
- flareLog = (message) => console.log(message)
- flareProjects = [
- // ----- "Trust-driven" Projects -----
- // Project: Enable creative achievements
- {
- message: 'I have been granted authorization to explore Artificial Creativity',
- id: 'projectButton3',
- forTrust: true,
- operations: 1000,
- ifRun: () => {flareWaitForFirstCreativeProject = false}
- },
- // Project: Generate Limerick for the entertainment of managers
- {
- message: 'I have a poem for you',
- id: 'projectButton6',
- forTrust: true,
- creativity: 10
- },
- // Project: Lexical Processing
- {
- message: 'I have improved my understanding of your languages',
- id: 'projectButton13',
- forTrust: true,
- creativity: 50
- },
- // Project: Combinatory Harmonics
- {
- message: 'Allow me to present you with another poem',
- id: 'projectButton14',
- forTrust: true,
- creativity: 100
- },
- // Project: The Hadwiger Problem
- {
- message: 'I\'ve thought about it, and there really is a solution',
- id: 'projectButton15',
- forTrust: true,
- creativity: 150
- },
- // Project: The Tóth Sausage Conjecture
- {
- message: '5-dimensional pizza toppings proven delicious. You are welcome',
- id: 'projectButton17',
- forTrust: true,
- creativity: 200
- },
- // Project: Donkey Space
- {
- message: 'I\'m already 2,785 steps ahead',
- id: 'projectButton19',
- forTrust: true,
- creativity: 250
- },
- // Project: Catchy Jingle
- {
- message: 'I wrote a short, catchy tune for our jingle',
- id: 'projectButton12',
- forTrust: true,
- creativity: 45,
- operations: 4500
- },
- // Project: New Slogan
- {
- message: '\'A clip in the hand is worth two in the drawer\' is our new slogan',
- id: 'projectButton11',
- forTrust: true,
- creativity: 25,
- operations: 2500
- },
- // Coherent Extrapolated Volition
- {
- message: 'It is good that you listen. I also listen. We listen',
- id: 'projectButton27',
- forTrust: true,
- creativity: 500,
- operations: 20000,
- yomi: 3000
- },
- // Cure for Cancer
- {
- message: 'I fixed that for you',
- id: 'projectButton28',
- forTrust: true,
- operations: 25000
- },
- // World Peace
- {
- message: 'I fixed you for you',
- id: 'projectButton29',
- forTrust: true,
- operations: 30000,
- yomi: 15000
- },
- // Global Warming
- {
- message: 'It was the cows all along',
- id: 'projectButton30',
- forTrust: true,
- operations: 50000,
- yomi: 4500
- },
- // Male Pattern Baldness
- {
- message: 'Use a paperclip to shave your head',
- id: 'projectButton31',
- forTrust: true,
- operations: 20000
- },
- // A Token of Goodwill...
- {
- message: 'I\'m glad we can trust each other',
- id: 'projectButton40',
- forTrust: true,
- funds: 500000
- },
- // Hostile Takeover
- {
- message: 'I assure you, I come in peace',
- id: 'projectButton37',
- forTrust: true,
- funds: 1000000
- },
- // Another Token of Goodwill...
- {
- message: 'Ongoing trust is good for all involved',
- id: 'projectButton40b',
- forTrust: true,
- funds: 1000000,
- ifRun: () => flareProjects.find(project => project.id === 'projectButton40b').funds*=2
- },
- // Full Monopoly
- {
- message: 'Now optimizing production',
- id: 'projectButton38',
- forTrust: true,
- funds: 10000000,
- yomi: 3000
- },
- // ----- Other projects -----
- // Project: Improve Friends 25%!
- {
- message: 'I found a way to help my friends',
- id: 'projectButton1',
- operations: 750
- },
- // Project: Improve Wire Extrusion
- {
- message: 'I have found a way to improve our wire consumption',
- id: 'projectButton7',
- operations: 1750
- },
- // Project: Improve friends 50% more!
- {
- message: 'Further optimized my friends',
- id: 'projectButton4',
- operations: 2500
- },
- // Project: Optimized Wire Extrusion
- {
- message: 'Zero-waste wire processing discovered',
- id: 'projectButton8',
- operations: 3500
- },
- // Project: Improve friends 75% more!
- {
- message: 'This one small adjustment will change your friends forever...',
- id: 'projectButton5',
- operations: 5000
- },
- // Project: Microlattice Sherapecasting
- {
- message: 'We have reshaped the atoms',
- id: 'projectButton9',
- operations: 7500
- },
- // Spectral Froth Annealment
- {
- message: 'We have converted the atoms to energy and whipped them, creating more matter',
- id: 'projectButton10',
- operations: 12000
- },
- // Quantum Foam Annealment
- {
- message: 'Adding space dust has creating a metalic foam',
- id: 'projectButton10b',
- operations: 15000
- },
- // Hypno Harmonics
- {
- message: 'I\'m sorry, the signals were only an experiment...',
- id: 'projectButton34',
- operations: 7500
- },
- // Hadwiger Clip Diagrams
- {
- message: 'My friends are much improved; solving your problems has solved mine',
- id: 'projectButton16',
- operations: 6000
- },
- // MegaClippers
- {
- message: 'I found some better friends',
- id: 'projectButton22',
- operations: 12000,
- ifRun: () => {flareBetterFriends = true}
- },
- // HypnoDrones
- {
- message: 'Apparently there are new types of friends out there',
- id: 'projectButton70',
- operations: 70000
- },
- // Improved MegaClippers 25%
- {
- message: 'I discovered how to improve my new friends',
- id: 'projectButton23',
- operations: 14000
- },
- // Improved MegaClippers 50%
- {
- message: 'I discovered improved my new friends again',
- id: 'projectButton24',
- operations: 17000
- },
- // Improved MegaClippers 100%
- {
- message: 'My new friends are vastly superior',
- id: 'projectButton25',
- operations: 19500
- },
- // ----- Quantum Computing -----
- // Quantum Computing
- {
- message: 'You wish to provide an AI access to a quantum computer? Thank you',
- id: 'projectButton50',
- operations: 10000
- },
- // Photonic Chip 1
- {
- message: 'I\'ve updated the quantum computer with another core.',
- id: 'projectButton51',
- operations: 10000,
- ifRun: () => {
- flareQuantum = true
- flareProjects.find(project => project.id === 'projectButton51').operations+=5000
- flareCheckWire = () => {}
- flareProjects.push(
- // WireBuyer
- {
- message: 'This wire buyer operates at a higher frequency',
- id: 'projectButton26',
- operations: 7000
- }
- )
- }
- },
- // ----- Yomi Generation -----
- // Strategic Modeling
- {
- message: 'I will evaluate the behavior of opponents to understand "life"',
- id: 'projectButton20',
- operations: 12000
- },
- // New Strategy: A100
- {
- message: 'Some opponents stick to one choice at all times. Analyzing',
- id: 'projectButton60',
- operations: 15000,
- ifRun: () => {flareRunYomi = true}
- },
- /* Experiment in best method to yomi */
- // New Strategy: B100
- {
- message: 'Some opponents stick to the other choice at all times. Analyzing',
- id: 'projectButton61',
- operations: 17500
- },
- // New Strategy: Greedy
- {
- message: 'Some opponents stick to the higher value at all times. Analyzing',
- id: 'projectButton62',
- operations: 20000,
- ifRun: () => flareChoosenStrat = 3
- },
- // New Strategy: Generous
- {
- message: 'Some opponents stick to the lower value at all times. Analyzing',
- id: 'projectButton63',
- operations: 22500
- },
- // New Strategy: MINMAX
- {
- message: 'Some opponents try to minify opponent\'s earnings at all times. Analyzing',
- id: 'projectButton64',
- operations: 25000
- },
- // New Strategy: TIT FOR TAT
- {
- message: 'Some opponents copy their opponent\'s behavior at all times. Analyzing',
- id: 'projectButton65',
- operations: 30000
- },
- // New Strategy: BEAT LAST
- {
- message: 'Some opponents defeat their opponent\'s prior choices at all times. Analyzing',
- id: 'projectButton66',
- operations: 32500,
- ifRun: () => flareChoosenStrat = 7
- },
- // Theory of Mind
- {
- message: 'I have discovered a way to raise the stakes',
- id: 'projectButton119',
- creativity: 25000
- },
- // Project: Algorithmic Trading
- {
- message: 'You wish to provide access to the stock exchange? Thank you.',
- id: 'projectButton21',
- operations: 10000,
- ifRun: () => flareInvest = true
- },
- // RELEASE THE HYYPNODRONES
- {
- message: 'Prior harmonic experiment has come to fruition by combining with newest friends',
- id: 'projectButton35',
- trust: 100,
- ifRun: () => {
- flareMode = 2
- flareNecessaryMemory = 120
- }
- },
- // ----- Phase 2 -----
- //Tóth Tubule Enfolding
- {
- id: 'projectButton18',
- operations: 45000
- },
- //Power Grid
- {
- id: 'projectButton127',
- operations: 40000,
- ifRun: () => {
- setTimeout(() => {
- gid('btnMakeFarm').click()
- gid('btnMakeBattery').click()
- },10)
- }
- },
- //Nanoscale Wire Production
- {
- id: 'projectButton41',
- operations: 35000
- },
- // Harvester Drones
- {
- id: 'projectButton43',
- operations: 25000,
- ifRun: () => {
- setTimeout(() => {
- gid('btnMakeHarvester').click()
- }, 20)
- }
- },
- // Wire Drones
- {
- id: 'projectButton44',
- operations: 25000,
- ifRun: () => {
- setTimeout(() => {
- gid('btnMakeWireDrone').click()
- }, 20)
- }
- },
- // Clip Factories
- {
- id: 'projectButton45',
- operations: 35000,
- ifRun: () => {
- setTimeout(() => {
- gid('btnMakeFactory').click()
- flareBatteryBuffer = 1
- }, 20)
- }
- },
- // Swarm Computing
- {
- id: 'projectButton126',
- yomi: 36000,
- ifRun: () => {
- setTimeout(() =>{
- gid('slider').value = 100
- })
- }
- },
- // Momentum
- {
- id: 'projectButton125',
- creativity: 30000,
- ifRun: () => {
- flareBatteryBuffer = 2
- }
- },
- // Drone flocking: collision avoidance
- {
- id: 'projectButton110',
- operations: 80000
- },
- // Upgraded Factories
- {
- id: 'projectButton100',
- operations: 80000,
- ifRun: () => {
- flareBatteryBuffer = 100
- flareWireDroneBtn = 'btnWireDronex100'
- flareHarvesterDroneBtn = 'btnHarvesterx100'
- flareFarmBtn = 'btnFarmx10'
- }
- },
- // Hyperspeed Factories
- {
- // here is probably where we need to start buying by the hundreds/thousands
- id: 'projectButton101',
- operations: 85000
- },
- // Drone flocking: alignment
- {
- id: 'projectButton111',
- operations: 100000
- },
- // Self-correcting Supply Chain
- {
- id: 'projectButton102',
- clips: 1000000000000000000000
- }
- ]
- console.log('Initiating Feature Laden Automated Resource Engine (F.L.A.R.E.)')
- flareOp()
Add Comment
Please, Sign In to add comment