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 consider enemy turn order #282
Conversation
ron-murhammer
commented
Nov 22, 2015
from the current AI players turn
isIgnoringRelationships); | ||
} | ||
|
||
public void findAttackOptions(final PlayerID player, final List<Territory> myUnitTerritories, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep this as one method rather than splitting it up as two? I'm also unsure why the method would be part of the public API and not private, but re-merging it back to one would make that a moot point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree. I ended up already doing this in the next set of changes. Really just did this to avoid having to update any references that called the original method without the extra parameter. I'd prefer to just merge this one as I have lots of refactoring changes already made in my next PR.
|
If it helps and will make the review easier, then please go for it. Otherwise personally I would like to keep this open for a bit as a reminder to add the unit test for the new code. |
To summarize, the AI plays conservative around can-openers to avoid losing its key factories and capital with this initial implementation and there are definitely ways to improve it but processing time needs to be considered.
|
AI consider enemy turn order
unit tests are effectively regression tests. Personally I would take out abstract out chunks of code wholesale into new modules that have nice API's, test those, then reduce the code and refactor more. Repeating enough times and the original code gets to be higher level and dependent on only stuff that has been tested. I've learned the hard way that you go faster when you clean the code first then do stuff. Working with dirty code and muddling through is just slower in the long run, generally hitting the few bugs and getting really slowed down by them can be the difference, and the worst case is more extreme. Once code is written though IMO you lose quite a bit of value from tests. They are good for telling you when you are done. For example in above, a stub interface and then writing tests that fail against an empty implementation would be a good way to generate tests before the implementation was copied over. *note: sorry if this is rough, didn't go through and edit it in favor of time. |