vherasymenk0 / hamster-kombat-automator

16 stars 9 forks source link

[Fix] buy multiple upgrades per iteration #8

Closed niklv closed 2 months ago

niklv commented 2 months ago

Problem

When there are a lot of coins on a balance and multiple upgrades available to buy, the automator sleeps until the next full energy restore, ignoring the coin balance and available upgrades. (issue #7)

Solution

Implement a cycle for purchasing upgrades. During each cycle, retrieve the available upgrades, check the coin balance, and either purchase an upgrade or delay the next purchase.

vherasymenk0 commented 2 months ago

There is some problem, you will buy all upgrades from the best p\e ratio to the worst until the balance is less than the worst p\e ratio upgrade, then you wait 600 seconds. After the second iteration this will not work well. You spend all the balance, wait 600 seconds, then buy again with all the balance, so after the first iteration of purchases, you will always buy the worst upgrades because you won't have enough balance for the others

vherasymenk0 commented 2 months ago

Im improved buying of upgrades logic, check out last commits

niklv commented 2 months ago

I tries to purchase best upgrade each iteration. Re-query upgrades each iteration. It did not skip upgrades and does not go to next available if there no money. It will sleep if there no money for best upgrade.