-
Notifications
You must be signed in to change notification settings - Fork 0
First tests and first bug found and fixed. #2
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
base: master
Are you sure you want to change the base?
Conversation
started writing tests (canBUyWeapon method)
|
|
||
| public static boolean winProbability(PlayerStatus opponent, int health, int score) { | ||
| @Override | ||
| public boolean myWinProbability(PlayerStatus opponent, int health, int score) { |
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.
Refactor this to use PlayerStatus opponent1, PlayerStatus opponent2 as parameters instead, to be more clear.
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.
solved in 535b2dd
| @Override | ||
| public boolean myWinProbability(PlayerStatus opponent, int health, int score) { | ||
| var opponentWinProb = (3 * opponent.getHealth() + opponent.getScore() / 1000) / 4; | ||
| var myWinProb = (3 * health + score / 1000) / 4; |
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.
Create another method that calculates win prob. taking a PlayerStatus player as parameter and use it here instead.
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.
solved
| public boolean shouldAttackOpponent(PlayerStatus opponent) { | ||
| if (opponent.getWeaponInHand() == weaponInHand) { | ||
| return winProbability(opponent, health, score); | ||
| return service.myWinProbability(opponent, health, score); |
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.
Refactor this to use as parameters (this, opponent) instead.
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.
solved
razvanexu
left a 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.
Please review my latest refactoring
|
Good to merge. |
No description provided.