Created
November 3, 2021 12:56
-
-
Save radoslawkalamon/ac226389587f50aa1ed741eca43f853e to your computer and use it in GitHub Desktop.
Cookie Clicker :: GetMostProfitableProducts
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
| (() => { | |
| const mostProfitableProductID = Game.ObjectsById | |
| .map(i => Game.cookies >= i.price ? (i.storedCps * Game.globalCpsMult) / i.price : 0) | |
| .reduce((iMax, x, i, arr) => x > arr[iMax] ? i : iMax, 0) | |
| const product = Game.ObjectsById[mostProfitableProductID] | |
| console.log(`Buying '${product.name}' for ${product.price} cookies...`) | |
| Game.ObjectsById[mostProfitableProductID].buy(1) | |
| })() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment