Cr4xy / agar-lvlgen

Agar-LvLGeN is a standalone implementation to farm XP at agar.
MIT License
52 stars 18 forks source link

2 Line Cleanup. #58

Closed makandz closed 8 years ago

makandz commented 8 years ago

Removed == true from two lines. Nothing else left to do :+1:

makandz commented 8 years ago

Psst @Cr4xy You should really add another collaborator to this repo so they don't have to make pull requests every time. wink wink :smile:

hassanila commented 8 years ago

@MastaCoder he added us as collaborators, yes.... but that doesnt mean we can control the repo.. We need write access to be able to merge our own PRs.. So @Cr4xy it would be nice that only the verified devs. (So that nothing stupid happens) that are helping and collaborating get the write access.. And also add Mastacoder as collabotator

Salvationdk commented 8 years ago
    // Live console developed by MastaCoder! (simplified by SALVATION)
    if (config.liveConsole == true) {
        process.stdout.write("\033[K\rSpawned: " + spawnedCount + " | Total: " + totalScore + " | Average: " + avgScore + " | Highest: " + highestScore + " | Time: " + currentSeconds);
    } else {
        console.log(debugObj);
    }

}, config.statusDelay);

instead of

    // Live console developed by MastaCoder!
    if (config.liveConsole == true) {
        if (consoleFix != true) {
            process.stdout.write("\rSpawned: " + spawnedCount + " | Total: " + totalScore + " | Average: " + avgScore + " | Highest: " + highestScore + " | Time: " + currentSeconds);
        } else {
            process.stdout.write("\rSpawned: " + spawnedCount + " | Total: " + totalScore + " | Average: " + avgScore + " | Highest: " + highestScore + " | Time: " + currentSeconds + "    ");
            consoleFix = false;
        }
    } else {
        console.log(debugObj);
    }

}, config.statusDelay);

also remove this

setInterval(function() {
    consoleFix = true;
}, 10000);

and this

` var consoleFix = false; // Adds spaces to remove extra numbers.

`

that would reduce some of the code

Erase to end of line: \033[K 9 lines of fewer code...

makandz commented 8 years ago

@Salvationdk I can't remove it because it will cause some issues. I actually added these lines on purpose.

process.stdout.write writes out the thing we want, it is basically console.log but without formatting. \r just overwrites that one line that it was on. But then this issue comes in, since it only replaces the characters that are there.

So if your bot goes from 1000 mass down to 44, there will be extra numbers at the end of the line because it hasn't removed those in the line remove. When the 10 second interval runs, it will add a couple spaces a the end of the line so it will remove those numbers. Why didn't I just keep the spaces there forever? Idk, possibly for future expanding ideas this will help :+1:

Salvationdk commented 8 years ago

process.stdout.write("\033[K\rSpawned: " + spawnedCount + " | Total: " + totalScore + " | Average: " + avgScore + " | Highest: " + highestScore + " | Time: " + currentSeconds);

this will overwrite the entire line and also the extra trailing numbers each time it is written to console.. that is why i added the \033[K

it is tested, and works..

makandz commented 8 years ago

Ah shit I probably should have read it more. Sorry!

Salvationdk commented 8 years ago

:)

Salvationdk commented 8 years ago

i have trouble setting up my fork and github to commit pulls. so i just type the changes here :)

makandz commented 8 years ago

@Salvationdk Done :)

Salvationdk commented 8 years ago

sweet.

Salvationdk commented 8 years ago

10 fewer lines :)

Salvationdk commented 8 years ago

how is that for your OCD :p

W1LKC0 commented 8 years ago

two tumbs up bitch :D

makandz commented 8 years ago

Another better PR was made for this :)