Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code enhancement suggestion #607

Open
FliiFe opened this issue Apr 20, 2016 · 3 comments
Open

Code enhancement suggestion #607

FliiFe opened this issue Apr 20, 2016 · 3 comments

Comments

@FliiFe
Copy link
Collaborator

FliiFe commented Apr 20, 2016

I'm creating this issue to avoid a lot of issues from being created for little code improvements.
So we should keep here every suggestion directly related to code, no feature request or bug fix request, just code correction suggestion.

Example of valid suggestion : #606

You should give code along with your proposal and where it should be added.

@FliiFe
Copy link
Collaborator Author

FliiFe commented Apr 20, 2016

@muratlahur No, there was an update on the map issue. Please see #597

@FliiFe
Copy link
Collaborator Author

FliiFe commented Apr 20, 2016

what it does is , it deletes food (like the virus one) near the walls , so the bot will never go towards a wall (or two walls which is a corner)

This is a behavior we don't want. We want food to be available wherever it is (except viruses), except when an enemy is dangerous.

Also, this looks like bad code (sorry :-/).
Can be written as

for (var j = foodList.length - 1; j >= 0; j--) {
    if (this.computeDistance(getMapStartX(), foodList[j][1], foodList[j][0], foodList[j][1]) < blob.size * 10) {
        foodList.splice(j, 1);
    }
    if (this.computeDistance(getMapEndX(), foodList[j][1], foodList[j][0], foodList[j][1]) < blob.size * 10) {
        foodList.splice(j, 1);
    }
    if (this.computeDistance(foodList[j][0], getMapEndY(), foodList[j][0], foodList[j][1]) < blob.size * 10) {
        foodList.splice(j, 1);
    }
    if (this.computeDistance(foodList[j][0], getMapStartY(), foodList[j][0], foodList[j][1]) < blob.size * 10) {
        foodList.splice(j, 1);
    }
}

@ermiyaeskandary
Copy link
Contributor

we need to know where the walls are ..

That's what he's saying. @muratlahur don't continue here - issue is being worked on

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants