#Exercise: D&D Character javaLink: https://exercism.org/tracks/java/exercises/dnd-character/edit

5 messages · Page 1 of 1 (latest)

eager halo
#

Hi everyone đź‘‹
I'm working on the D&D Character exercise, and I'm a bit confused about the expected behavior of the ability() method.

Initially, I assumed that we might sometimes be given the scores for the abilities directly — and only in that case, the ability()method gets called. Otherwise, I thought the user should roll the dice to generate the scores for each ability.

I implemented the solution based on that understanding, but many test cases are failing. I re-read the instructions several times but couldn't find anything that clearly explains the role of the ability() method. Even the test cases don’t seem to call or directly explain its use.

Could someone help clarify what exactly the exercise wants us to do — especially regarding how ability() should work?

Thanks in advance 🙏

wicked birch
#

Also the tests do actually call the ability Method, here's two examples

public void testAbilityCalculationsWithHighestEqualNumbers() {
        assertThat(dndCharacter.ability(List.of(6, 6, 6, 6))).isEqualTo(18);
    }
public void testAbilityCalculationsWithTwoLowestNumbers() {
        assertThat(dndCharacter.ability(List.of(3, 5, 3, 4))).isEqualTo(12);
    }
eager halo
wicked birch
#

roll dice should roll the dice
ability should be able to take these rolls and calculate the final score of the ability