Bitburner

Bitburner

27 Bewertungen
Bitburner Contracts for Dummies
Von Zac Starfire
A short guide and simple working scripts for solving Bitburner Coding Contracts.
3
2
   
Preis verleihen
Favorisieren
Favorisiert
Entfernen
The Beginning
       In Bitburner, you need to gain reputation with factions, gangs and corporations to gain access to their augments for purchase. Initially you are challenged by the factions to get their augments and then you need to work for the corporations/gangs for their augments. First there are the beginner city faction augments you can get depending if you go with the western or eastern factions (About 40 for the western and city factions). Later you will have access to the corporation augments (after 400k reputation for each corporation) and other later factions or gangs, which are more expensive and powerful. For example, after purchasing 36 augments, the SmartJaw from Bachman & Associates will cost me $29.817Q (Q not q) and 375.000k reputation. Of course I am not going to buy it until after I install 40 augments, come back more twinked to go farther and will be much cheaper to buy (assuming the prices reset as well). I also have to work for the eastern city factions and see what they have after I augment since I've been working for the western city factions which disqualifies you to work for the eastern city factions.
The Codez
     You can gain reputation for factions and corporations by either doing Hacking Contracts or Coding Contracts. Initially, you’ll need to do Hacking Contracts for factions to get access to your first augmentations. Hacking Contracts are found when you goto the factions left menu option under Character. Later when you need more reputation for corporation augments you’ll need to do the Coding Contracts as well to get the necessary reputation. There are also more factions and even gangs you will encounter and join after your first augmentation.

     Doing Coding Contracts can gain you around 4 per second in reputation and sharing your servers can increase that as much as 1-4 more per second. You can also get every server under your control to help out as well. Remember, you don't have to share out your entire home computer or servers, you can leave enough RAM to do other things.

Here is a sample sharing helper script:
/** @param {NS} ns **/ export async function main(ns) { // Logging ns.disableLog('ALL') ns.tail(); // Main while (true) { ns.print("Time: " + new Date().toLocaleTimeString()); await ns.share(); let sharePower = ns.getSharePower(); ns.print("Share Power is " + sharePower); ns.print("--------------------------------"); } }

    Very simple, eh? You’ll need to modify your automation scripts to use the sharing script or incorporate it into your own scripts. It works with my automation script provide with my Hacking for Dummies Guide as is. Just comment the hack script and uncomment the share script in the header of the script.

Here's an home sharing example:
/** @param {NS} ns */ export async function main(ns) { let threads = ns.args[0]; let script = '/scripts/share.js'; //ns.killall('home'); //Useful sometimes let ramAvailable = ns.getServerMaxRam('home') - ns.getServerUsedRam('home'); let ramPerThread = ns.getScriptRam(script); let threadsAvailable = Math.floor(ramAvailable / ramPerThread) - 5; ns.tprint(threadsAvailable + " threads can be runned on home."); if (threadsAvailable > 0) { if (!threads) threads = threadsAvailable; ns.tprint("Starting share.js on with home."); ns.exec(script, 'home', threads); } else { ns.tprint("NOT ENOUGH MEMORY ON home."); } }

alias homeshare="run homeshare.js"
homeshare 1000000


Note you can pass how many threads to use, otherwise it will use any available memory on the server you run it on.

To check your share power, hacking level and other information about yourself, you can run this script:
/** @param {NS} ns */ export async function main(ns) { let player = ns.getPlayer(); let totalSharePower = ns.getSharePower(); let hackingLevel = ns.getHackingLevel(); ns.tprint("Hacking Level = " + hackingLevel); ns.tprint("Share Power = " + totalSharePower); ns.tprint("Bitnodes = " + player.bitNodeN); ns.tprint("People Killed = " + player.numPeopleKilled); ns.tprint("Karma = " + ns.heart.break().toFixed(2)); }

alias getinfo="run getinfo.js"
getinfo


     This script demonstrates using Netscript and your player object to get additional information. I’ve included a few bits of hidden information that is used later in the game that is not normally displayed in the overview or character stats. There's actually much for information you can gleam from player object from the getPlayer() function:

https://github.com/danielyxie/bitburner/blob/dev/markdown/bitburner.player.md

     You may also have noticed on servers you encounter in Bitburner with *.cct files if you do a ls (list) command to list out the files on the servers, including your home computer (except for servers you bought like your server farm or helper servers you purchased). These are Coding Contracts from the various factions and corporations in Bitburner. They contain complex programming problems you would normally encounter taking a high-level computer science course at a really good university. You get a limited amount of guesses before it self-destructs and if you solve the problem, you can get money or reputation from the factions or companies who placed the contract.

For more information on Coding Contract types, look here:
https://bitburner.readthedocs.io/en/latest/basicgameplay/codingcontracts.html

     Here is a simple script to crawl the network, search all the servers and find all the contracts on them. The code is a bit long, so I've saved it to Github. Simply cut and paste it from Notepad (or .txt other editor) into nano on Bitburner and don't forget to save as a '.js' file. If you pass a faction or corporation as an argument, it will display the servers that have contracts for that faction/corporation. You can also pass 'other' to get the contracts that are for multiple factions/corporations.



findcontracts.js:
https://github.com/zacstarfire/bitburner/blob/main/contracts/findcontracts.js

alias findcontracts="run findcontracts.js"
findcontracts other


     I’m at a bit of a disadvantage to solving the Coding Contracts since I attended some crappy Tech Schools during the 1980s that didn’t have any good math courses other than a useless calculus course for electronics engineering, which I never used again (I do have a bachelor degrees in Computer Science and Electronics Engineering). And in the 30+ years I’ve worked and retired as Senior Programmer, I’ve never encountered problems like these and even if I did, the math and formulas would probably be supplied to me after being approved by management.

     So, once again, I’ve scoured the internet for the solutions for the Coding Contracts. Most of the solution code came from this huge automation suite by someone named ‘alainbryden’, that I never got working because it was a bit out-dated, had some errors and I don’t have the time to debug and mess with it all. I have no idea who he is, if he’s even on Steam, Reddit or around anymore, but he did some good work on the solver code and had nearly all the solutions. The master script and the helper script is written by me, also I fixed a few errors in the transplanted solver code that the editor was complaining about.



     These are much larger scripts so I’m putting them in text files on Github to download. Simply cut and paste them into nano on Bitburner. There are two files: The master script (solveallcontracts.js) and the helper script(solvecontract.js):

solveallcontracts.js:
https://github.com/zacstarfire/bitburner/blob/main/contracts/solveallcontracts.js

solvecontract.js:
https://github.com/zacstarfire/bitburner/blob/main/contracts/solvecontract.js

alias solveallcontracts="run solveallcontracts.js"
solveallcontracts


     Make sure you have the proper file name you used to save the scripts in the master script if you change anything.
The Bugz
     I noticed a bug today that when a server has more than one contract, it only solves one of them. For now, just keep running the script until it completes all the contracts. I'll look into it and fix it soon.

     There may be Coding Contracts you may find that are unsolvable by the script, I’ll update the helper script as I find solutions. Or if you have a solution, please leave a comment and I’ll update the helper script for everyone else. Please comment if you find anything else and I'll fix it.
The End
     Well, hopefully I have helped you along in your Bitburner journey and have inspired you to continue playing Bitburner addictively and maybe leave a good review for it so that maybe someday it will be recognized by Steam as a regular game (then the Steam achievements will hopefully apply officially)!

     Go ahead and use my scripts as templates to learn from and build your own scripts. I’ve been programming for over 30 years (I am a retired Software Engineer) since the dawn of personal computers in way too many different languages and platforms including mainframes even - really! So, I think I've learned some good programming habits and programming patterns over the years, if very old-school-ish.

Please rate & favorite my Bitburner guides. The game has a very small community and I could use any help getting the rating stars going on them. I'll also return the favor if you tell me what you need.

Also, please read the entire series:
https://steamcommunity.com/sharedfiles/filedetails/?id=2860828429

https://steamcommunity.com/sharedfiles/filedetails/?id=2860330999

https://steamcommunity.com/sharedfiles/filedetails/?id=2863116304

https://steamcommunity.com/sharedfiles/filedetails/?id=2874771586

Disclaimer: 'The For Dummies; in the title is just a name I borrowed from an old series of books from the 1990's, by the way, not to call anyone a Dummy or even an Ape. :p

https://en.wikipedia.org/wiki/For_Dummies

This guide was created by Zac Starfire on Steam. If you found it on another server, that is where it originated.
Change Log
3/2/23
- Added Scripts guide link

10/13/22
- Moved code to Github so Steam wouldn't screw with it.

9/28/22
- Added images for findcontracts.js and solveallcontracts.js.

9/19/22
- Minor edits, fixes and stuff that needed adjustment.

9/15/22
- Added my share automation script and fixed a few things

9/16/22
- Added Change Log section and moved my change comments to that section.
- Minor fixes and some more stuff.
11 Kommentare
redlink2579 19. März um 10:07 
@xptical Nothing bad will happen I can assure you, You can just add it like this

ns.print("Solving" + contract.fileName + " at " + contract.server + "...")
redlink2579 19. März um 10:02 
@Nek From what I know this is caused by the new contract "Square Root" which require you to find the square root of really big number(~200 digits), the problem stem from how ns.codingcontract.getData() return the number in solveallcontracts.js and the script tries to stringify it to send it to solvecontract.js in which JSON.stringify throw error due to big integer.
You can fix this by adding the following to solveallcontracts.js

const replacer = (key, value) =>
typeof value === "bigint" ? { $bigint: value.toString() } : value;

and then add replacer to all instance of JSON.stringify(contract) like this

JSON.stringify(contract, replacer)

Note that this will still make all contract that is "Square Root" type unsolvable, You gonna have to figure that out somehow since I got to message limit now
xptical 6. Feb. um 6:43 
Look at the line that prints "Solving " and then some code. The contract.filename is pulled from block above. There is also a useful contract.server value.

Wonder what happens when you add more information to the "Solving " line? Like maybe some spaces and a server name where it's actually working.

Good luck.
Nek 3. Jan. um 2:30 
Hey there, I recently use the coding contracts to make my life easier (and it did!) but... Got an error saying the scripts doesn't know how to solve BIG Int... Is it missing from the scripts? I can't run the scripts anymore because I don't know where the contract is specifically and there's about 190 contracts left to do...
Grimwald 30. Juli 2024 um 3:50 
Amazing to put this together. Thank you so much. I avoided contracts because the ROI was so low outside of a few that I could find online "calculators" for. :steamfacepalm:

As of July 2024 if you download from Github and put all your scripts in one level/folder then change inside "solveallcontracts.js":

const solveContractScript = "/contracts/solvecontract.js";

To:
const solveContractScript = "solvecontracts.js";
Krizso 11. Juni 2023 um 0:49 
@Altercraft I think I might have found your problem. I the solveallcontract.js it calls for contracts\solvecontract.js. So you have to put the solvecontract.js in a folder, or you have to edit solveallcontract.js so it will call it in the main folder
Zac Starfire  [Autor] 9. Apr. 2023 um 16:08 
I don't know, I updated them this morning and tested them.
Altercraft 9. Apr. 2023 um 11:15 
Uh....looks like the latest commits on github were from October last year. What am I missing?
Zac Starfire  [Autor] 9. Apr. 2023 um 6:44 
Some bug was introduced when I uploaded them to GitHub.
I re-uploaded them, tested them and they are working now.
Just delete the 2 scripts and re-download them from GitHub.
Altercraft 8. Apr. 2023 um 18:28 
I seem to have an issue. I've copied both scripts to my game. When I run the solveallcontracts script it outputs like it's trying, it outputs that it has solved them but in reality nothing changed, the scripts are still present and no rewards are offered.