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

first crack at bot minefield avoidance #2898

Merged
merged 5 commits into from
Jun 3, 2021

Conversation

NickAragua
Copy link
Member

This is the first attempt at having the bot try to avoid minefields. The basic gist is that the bot will generally prefer not to step on mines if she thinks she will detonate them. The bot client only has access to minefields it knows about.

More detailed breakdown:

  • when generating ground paths for mechs, due to the specialized nature of the routine, strongly prefer to retain paths that do not go over known minefields.
  • when generating long range movement paths, strongly prefer to avoid paths that do not go over known minefields.
  • when evaluating generated paths, prefer to avoid paths that go over minefields

@lgtm-com
Copy link

lgtm-com bot commented Jun 2, 2021

This pull request introduces 1 alert when merging 4ad1b45 into 588f8b0 - view on LGTM.com

new alerts:

  • 1 for Boxed variable is never null

@Windchild292
Copy link
Contributor

This needs a CI fix, as it is causing a test to NPE

Copy link
Contributor

@Windchild292 Windchild292 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good in general, just a few things first

megamek/src/megamek/client/bot/princess/MinefieldUtil.java Outdated Show resolved Hide resolved
megamek/src/megamek/client/bot/princess/MinefieldUtil.java Outdated Show resolved Hide resolved
megamek/src/megamek/client/bot/princess/MinefieldUtil.java Outdated Show resolved Hide resolved
Comment on lines +128 to +131
if (s == 0) {
return super.compare(first, second);
} else {
return s;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ternary return candidate

@lgtm-com
Copy link

lgtm-com bot commented Jun 2, 2021

This pull request introduces 1 alert when merging d4eff68 into 588f8b0 - view on LGTM.com

new alerts:

  • 1 for Boxed variable is never null

Copy link
Contributor

@Windchild292 Windchild292 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just the one missing bracket set


double hazardAccumulator = 0;
// hovercraft and WIGEs grinding along the ground detonate minefields on a 12
boolean hoverMovement = movingUnit.getMovementMode() == EntityMovementMode.HOVER ||
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brackets

@NickAragua NickAragua merged commit 36f8e35 into MegaMek:master Jun 3, 2021
@NickAragua NickAragua deleted the minefield_avoidance branch June 3, 2021 01:19
@lgtm-com
Copy link

lgtm-com bot commented Jun 3, 2021

This pull request introduces 1 alert when merging 2397621 into 588f8b0 - view on LGTM.com

new alerts:

  • 1 for Boxed variable is never null

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

Successfully merging this pull request may close these issues.

3 participants