Skip to content
This repository has been archived by the owner on Jul 17, 2018. It is now read-only.

Stuck on planets with no high threat tiles? #31

Closed
EinarGissurar opened this issue Jun 22, 2018 · 1 comment
Closed

Stuck on planets with no high threat tiles? #31

EinarGissurar opened this issue Jun 22, 2018 · 1 comment

Comments

@EinarGissurar
Copy link

EinarGissurar commented Jun 22, 2018

There's a tiny problem with the current build that's only an issue when you're focusing on leveling up.

Since the code focuses on selecting planets with the highest progress, you end up on worlds where all the high threat (and eventually the middle threat) tiles have been used up, while planets that still have those tiles available are still available.

I messed around with the GetBestPlanet function, so that it selected the planet with the lowest progress. Here's what I did:
`
const GetBestPlanet = function GetBestPlanet() {
let bestPlanet;
let worstPlanet;
let maxProgress = 0;
let worstProgress = Number.MAX_VALUE;

if (!GAME.m_State.m_mapPlanets)
    return;


for (let planetKV of GAME.m_State.m_mapPlanets) {
    let planet = planetKV[1];
    if(planet.state.active && !planet.state.captured && planet.state.capture_progress > maxProgress) {
        maxProgress = planet.state.capture_progress;
        bestPlanet = planet;
    }
    if(planet.state.capture_progress < worstProgress) {
        worstProgress = planet.state.capture_progress;
        worstPlanet = planet;
    }
}

if (worstPlanet) {
    console.log(`selecting planet ${worstPlanet.state.name} with progress: ${worstPlanet.state.capture_progress}`);
    return worstPlanet.id;
}
/*if(bestPlanet) {
    console.log(`selecting planet ${bestPlanet.state.name} with progress: ${bestPlanet.state.capture_progress}`);
    return bestPlanet.id;
}*/

}
`

This works for me as the bot is now selecting the least progressed planet.

I'm wondering now if this should be added, where the bot priorities low progress planets, while player is still leveling up.

@meepen
Copy link
Owner

meepen commented Jun 22, 2018

GetBestPlanet only runs once so it's not exactly the best place to choose this, but if you want to try and find other planets before selecting a zone you can try that as well, but you would need a state to track them.

@meepen meepen closed this as completed Jun 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants