First tests and first bug found and fixed. - #2
Conversation
started writing tests (canBUyWeapon method)
Uh oh!
There was an error while loading. Please reload this page.
| 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.
Refactor this to use PlayerStatus opponent1, PlayerStatus opponent2 as parameters instead, to be more clear.
| @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.
Create another method that calculates win prob. taking a PlayerStatus player as parameter and use it here instead.
| 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.
Refactor this to use as parameters (this, opponent) instead.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
razvanexu
left a comment
There was a problem hiding this comment.
Please review my latest refactoring
radduC
commented
Jun 11, 2024
Good to merge. |
No description provided.