Skip to content

Instantly share code, notes, and snippets.

@radoslawkalamon
Created November 3, 2021 12:56
Show Gist options
  • Select an option

  • Save radoslawkalamon/ac226389587f50aa1ed741eca43f853e to your computer and use it in GitHub Desktop.

Select an option

Save radoslawkalamon/ac226389587f50aa1ed741eca43f853e to your computer and use it in GitHub Desktop.
Cookie Clicker :: GetMostProfitableProducts
(() => {
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