Skip to content

Conversation

@razvanexu
Copy link
Owner

No description provided.

@razvanexu razvanexu requested a review from radduC June 6, 2024 20:05

public static boolean winProbability(PlayerStatus opponent, int health, int score) {
@Override
public boolean myWinProbability(PlayerStatus opponent, int health, int score) {
Copy link
Collaborator

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.

Copy link
Owner Author

@razvanexu razvanexu Jun 10, 2024

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;
Copy link
Collaborator

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.

Copy link
Owner Author

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);
Copy link
Collaborator

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.

Copy link
Owner Author

Choose a reason for hiding this comment

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

solved

Copy link
Owner Author

@razvanexu razvanexu left a 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

@radduC
Copy link
Collaborator

radduC commented Jun 11, 2024

Good to merge.

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