-
Notifications
You must be signed in to change notification settings - Fork 327
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
feat: slightly better serializer for unit actions and state, added attack action too #6834
base: master
Are you sure you want to change the base?
Conversation
3f2468e
to
b8e250b
Compare
b8e250b
to
3cbd32b
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6834 +/- ##
============================================
+ Coverage 30.05% 30.12% +0.07%
- Complexity 15587 15621 +34
============================================
Files 2875 2884 +9
Lines 282748 283107 +359
Branches 49302 49296 -6
============================================
+ Hits 84988 85299 +311
- Misses 192210 192246 +36
- Partials 5550 5562 +12 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
fd7fbb0
to
44d6fd4
Compare
44d6fd4
to
2f6f202
Compare
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.
Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.
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.
Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.
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.
Copilot reviewed 15 out of 15 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (3)
megamek/src/megamek/common/Compute.java:474
- Verify the removal of the 'false' parameter from the climb method call to ensure that the change in behavior is intentional.
game.getBoard().getHex(coords), elevation, climbMode);
megamek/src/megamek/ai/dataset/UnitAction.java:62
- The update of the initial value in the reduce operation from 0.0 to 1.0 is crucial for correctly computing the chanceOfFailure; please document or verify that multiplying the PSR values was the intended fix.
double chanceOfFailure = SharedUtility.getPSRList(movePath).stream()
.map(psr -> psr.getValue() / 36d)
.reduce(1.0, (a, b) -> a * b);
megamek/src/megamek/ai/dataset/UnitStateSerializer.java:70
- Ensure that additional fields (like HAS_ECM and armor side percentages) introduced in the UnitState record are adequately tested in the serializer tests.
row[UnitStateField.HAS_ECM.ordinal()] = obj.hasEcm() ? "1" : "0";
cfc9e35
to
d0df602
Compare
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.
After some discussion on Discord I have changed my mind on the records approach.
Everything looks good, excited to see the next steps!
431ab09
to
ca4c558
Compare
And I changed my mind... this is really annoying to improve upon, so I am throwing the towel and going for the thing I didnt wanted to do before but is possibly the correct solution, using an EnumHashMap to hold the values and use reflection to serialize the object. |
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.
Looks good! Nice job compacting some of that code down.
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.
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
megamek/src/megamek/common/Compute.java:474
- The removal of the false boolean argument in the climb method call appears intentional. Please verify that the change aligns with the updated method signature and intended behavior.
elevation, climbMode);
logger.error(ex, "Error logging Attack unit action"); | ||
} |
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.
The logger.error call here reverses the parameter order compared to other error logs. For consistency and clarity, update it to logger.error("Error logging Attack unit action", ex).
logger.error(ex, "Error logging Attack unit action"); | |
} | |
logger.error("Error logging Attack unit action", ex); |
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
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.
The original code is correct
7b195f9
to
116302e
Compare
What it does?
Improves the current TSV Serializer and the actions for the game dataset logger.