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

AI does not expand to unguarded enemy land #3423

Closed
bunnybot opened this issue Sep 9, 2019 · 4 comments
Closed

AI does not expand to unguarded enemy land #3423

bunnybot opened this issue Sep 9, 2019 · 4 comments
Labels
ai Computer players
Milestone

Comments

@bunnybot
Copy link

bunnybot commented Sep 9, 2019

AI does not expand into unguarded but enemy owned land. this is due to only unowned spots are taken into account for this consideration.

relevant code is in defaultai.cc line 1329 following.

proposal is to change line 1329 like the following

if (field.unowned_land_nearby > 0 || (field.enemy_owned_land_nearby > 0 && field.enemy_military_presence < std::abs(management_data.get_military_number_at(??) / 6))) {

furthermore this would lead to the addition of the following block after line 1335

field.unowned_buildable_spots_nearby +=
map.find_fields(Area(field.coords, kBuildableSpotsCheckArea),
&found_buildable_fields, find_enemy_owned_walkable);

already tested this solution and it works


Imported from Launchpad using lp2gh.

@bunnybot bunnybot added ai Computer players Fix Committed labels Sep 9, 2019
@bunnybot
Copy link
Author

bunnybot commented Sep 9, 2019

(by tiborb95)
what is that "??"

@bunnybot
Copy link
Author

bunnybot commented Sep 9, 2019

(by stephan-lutz)
?? is a placeholder for an unused military_number. Sorry should have explained that.

@bunnybot
Copy link
Author

bunnybot commented Sep 9, 2019

(by tiborb95)
OK, I believed that you already has the code... Do you need some help with finding unused number? I am using grep for this...

Will you propose merging the branch? it would be easier to see changes...

@bunnybot
Copy link
Author

bunnybot commented Sep 9, 2019

(by stephan-lutz)
I tested the code with a hardcoded value of 3 (which means an enemy military presence of 3 is allowed), but I thought some genetics should apply here.

@bunnybot bunnybot added this to the build21-rc1 milestone Sep 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ai Computer players
Projects
None yet
Development

No branches or pull requests

2 participants