Ga naar de inhoud
Rel-bits

Rel-bits

  • Thuis
  • Nieuws
  • Gidsen
  • Videogidsen
  • Patch-opmerkingen
  • Misbruik melden
  • Toggle zoekformulier
Bitburner

Bitburner – Optimized Hacknet Bot

Geplaatst op 01/15/2022 Deur syw1 Geen reacties op Bitburner – Optimized Hacknet Bot
  • Titel: Bitburner
  • Releasedatum:
  • Ontwikkelaar:
  • Uitgever:
Informatie over Bitburner is nog steeds onvolledig. Help ons alstublieft de details van het spel hiermee in te vullen contactformulier.

Simple Bot that uses math to choose the most profitable upgrade.

How It Works

The bot takes the following steps.

  1. Checks cost and production growth of all the possible upgrades
  2. Calculates profitable ratio of each upgrade
  3. Sorts elements by ratio descending
  4. Chooses the first element
  5. Checks if you can purchase upgrade now, if not, it waits to collect money
  6. Checks if you can buy a new node in less than 30 seconden (you can customize this time), zo ja, it buys it
  7. Herhalen…

Profitable ratio = Production growth / upgrade cost
Production growth = Production after upgrade / current production

This guide is based on my previous “Automation for Hacknet Nodes”.

Hoe te gebruiken

Take the following steps.

  1. Run the terminal
  2. Type ‘nano hacknet-bot.js’
  3. Copy and paste the code below into this file
  4. Sla het bestand op (ctrl + S)
  5. Back to the terminal
  6. Type ‘run hacknet-bot.js’

/** @param {NS} ns **/
export async function main(ns) {
	// helpers
	const getMoney = () => ns.getPlayer().geld;
	const getProd = (niveau, ram, cores) => (niveau * 1.5) * Math.pow(1.035, ram - 1) * ((cores + 5) / 6);
	// your production multiplier
	const PROD_MULTIPLIER = ns.getHacknetMultipliers().production;
	// maximum waiting time for collecting money for new node (default 30s)
	const WAITING_TIME = ns.args[0] || 30;

	terwijl (WAAR) {
		const ratios = [];
		let hacknetProduction = 0;
		// loop through all nodes
		for (let index = 0; index < ns.hacknet.numNodes(); index++) { // get current node stats const { niveau, ram, cores, production } = ns.hacknet.getNodeStats(index); hacknetProduction += production; // get upgrades cost const levelUpgradeCost = ns.hacknet.getLevelUpgradeCost(index); const ramUpgradeCost = ns.hacknet.getRamUpgradeCost(index); const coreUpgradeCost = ns.hacknet.getCoreUpgradeCost(index); // get prod. growth / cost ratios const levelUpgradeRatio = ((getProd(niveau + 1, ram, cores) * PROD_MULTIPLIER) - production) / levelUpgradeCost; const ramUpgradeRatio = ((getProd(niveau, ram * 2, cores) * PROD_MULTIPLIER) - production) / ramUpgradeCost; const coreUpgradeRatio = ((getProd(niveau, ram, cores + 1) * PROD_MULTIPLIER) - production) / coreUpgradeCost; // possible upgrades of current node const currentNodeUpgrades = [ {ratio: levelUpgradeRatio, cost: levelUpgradeCost, nodeIndex: index, upgraden: "niveau"}, {ratio: ramUpgradeRatio, cost: ramUpgradeCost, nodeIndex: index, upgraden: "ram"}, {ratio: coreUpgradeRatio, cost: coreUpgradeCost, nodeIndex: index, upgraden: "core"} ]; // push current node upgrades to all upgrades ratios.push(...currentNodeUpgrades); } // get the most profitable upgrade const { cost, nodeIndex, upgraden } = ratios.sort((A, B) => b.ratio - a.ratio)[0];
		// wait until you have the money for upgrade
		while (getMoney() < cost) { await ns.sleep(1); } // execute upgrade switch (upgraden) { geval "niveau": await ns.hacknet.upgradeLevel(nodeIndex); break; geval "ram": await ns.hacknet.upgradeRam(nodeIndex); break; geval "core": await ns.hacknet.upgradeCore(nodeIndex); break; standaard: doorgaan; } // check if you can purchase new node const purchaseNodeCost = ns.hacknet.getPurchaseNodeCost(); const missingMoneyForNewNode = purchaseNodeCost - getMoney(); if (missingMoneyForNewNode > 0 && missingMoneyForNewNode < hacknetProduction * WAITING_TIME) {
			// if you need to wait for purchase node less than WAITING_TIME (in seconden) program waits to collect money
			while (getMoney() < purchaseNodeCost) {
				await ns.sleep(1);
			}
			ns.hacknet.purchaseNode();
		}

		// sleep 1ms to prevent crash because of infinite loop
		await ns.sleep(1);
	}
}

You can customize the time of waiting for purchase node (by default 30s) by passing an additional script argument. Bijvoorbeeld:

run hacknet-bot.js 120

Dat is alles wat we vandaag hiervoor delen Bitburner gids. Deze handleiding is oorspronkelijk gemaakt en geschreven door syw1. Voor het geval we er niet in slagen deze handleiding bij te werken, U kunt de laatste update vinden door dit te volgen link.

Als u van mening bent dat de inhoud van deze site uw rechten schendt, inclusief uw intellectuele eigendomsrechten, neem dan direct contact met ons op via ons contactformulier.
Gidsen Labels:Bitburner

Bericht navigatie

Vorig bericht: Thea 2: The Shattering – All Theopedia Terrain List
Volgende bericht: Ontsnappingssimulator – Wallace in Yonderland Walkthrough

Geef een reactie Reactie annuleren

Je e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *

  • Titel: Bitburner
  • Releasedatum:
  • Ontwikkelaar:
  • Uitgever:
Informatie over Bitburner is nog steeds onvolledig. Help ons alstublieft de details van het spel hiermee in te vullen contactformulier.

Vrijwaring

Alle geciteerde inhoud is afgeleid van hun respectieve bronnen. Als u denkt dat wij uw inhoud zonder toestemming hebben gebruikt, Zorg ervoor dat u ons bereikt en wij zullen het serieus nemen.
  • Over ons
  • Neem contact met ons op
  • Privacybeleid
  • Servicevoorwaarden

Auteursrecht © 2025 Rel-bits.

Aangedreven door PersBoek Nieuws WordPress thema