-
Notifications
You must be signed in to change notification settings - Fork 299
implemention of #308 hacknet nodes max ram usage #314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
samohtGTO
wants to merge
4
commits into
alainbryden:main
Choose a base branch
from
samohtGTO:samohtGTO/issue308
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -33,6 +33,7 @@ const argsSchema = [ | |||||
| ['n', false], // Can toggle on using hacknet nodes for extra hacking ram (at the expense of hash production) | ||||||
| ['use-hacknet-nodes', false], // Same as above (kept for backwards compatibility, but these are now called hacknet-servers) | ||||||
| ['use-hacknet-servers', false], // Same as above, but the game recently renamed these | ||||||
| ['hacknet-use-ram-percentage', 0.75], | ||||||
| ['spend-hashes-for-money-when-under', 10E6], // (Default 10m) Convert 4 hashes to money whenever we're below this amount | ||||||
| ['disable-spend-hashes', false], // An easy way to set the above to a very large negative number, thus never spending hashes for Money | ||||||
| ['silent-misfires', false], // Instruct remote scripts not to alert when they misfire | ||||||
|
|
@@ -118,6 +119,7 @@ let xpOnly = false; // "-x" command line arg - focus on a strategy that produces | |||||
| let verbose = false; // "-v" command line arg - Detailed logs about batch scheduling / tuning | ||||||
| let runOnce = false; // "-o" command line arg - Good for debugging, run the main targettomg loop once then stop | ||||||
| let useHacknetNodes = false; // "-n" command line arg - Can toggle using hacknet nodes for extra hacking ram | ||||||
| let hacknetUsePercentage = 0.75 // How much ram percentage ram from the hacknet is getting used. | ||||||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| let loopingMode = false; | ||||||
| let recoveryThreadPadding = 1; // How many multiples to increase the weaken/grow threads to recovery from misfires automatically (useful when RAM is abundant and timings are tight) | ||||||
|
|
||||||
|
|
@@ -250,6 +252,7 @@ export async function main(ns) { | |||||
| stockMode = (options.s || options['stock-manipulation'] || options['stock-manipulation-focus']) && !options['disable-stock-manipulation']; | ||||||
| stockFocus = options['stock-manipulation-focus'] && !options['disable-stock-manipulation']; | ||||||
| useHacknetNodes = options.n || options['use-hacknet-nodes'] || options['use-hacknet-servers']; | ||||||
| hacknetUsePercentage = Math.max(options['hacknet-use-ram-percentage']) | ||||||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Not sure why the max was there, it would do nothing |
||||||
| verbose = options.v || options['verbose']; | ||||||
| runOnce = options.o || options['run-once']; | ||||||
| loopingMode = options['looping-mode']; | ||||||
|
|
@@ -1008,8 +1011,11 @@ class Server { | |||||
| isHost() { return this.name == daemonHost; } | ||||||
| totalRam() { | ||||||
| let maxRam = this.ns.getServerMaxRam(this.name); | ||||||
| if (this.name == "home") | ||||||
| if (this.name == "home") { | ||||||
| maxRam = Math.max(0, maxRam - homeReservedRam); // Complete HACK: but for most planning purposes, we want to pretend home has less ram to leave room for temp scripts to run | ||||||
| } else if (this.name.startsWith('hacknet-server-')) { | ||||||
| maxRam = maxRam * hacknetUsePercentage; | ||||||
| } | ||||||
| return maxRam; | ||||||
| } | ||||||
| usedRam() { return this.ns.getServerUsedRam(this.name); } | ||||||
|
|
||||||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.