exercism / vimscript

Exercism exercises in Vim script.
https://exercism.org/tracks/vimscript
MIT License
20 stars 24 forks source link

Add dnd-character #193

Closed BNAndras closed 9 months ago

BNAndras commented 10 months ago

I don't see a way of having students actually use randomly generated numbers, but I feel like it'd be evident in a mentoring discussion if a student didn't do that.

The test generator had trouble with the last three tests so tomorrow, I'll file another issue with the specifics.

BNAndras commented 10 months ago

Related to #172

BNAndras commented 10 months ago

@kotp, should I bump the difficulty? It's at 3, but students will need to figure out how to generate random numbers. A difficulty of 4 would mark it as a medium difficulty exercise.

I'm also thinking we add a test where we create two characters and compare their total ability score across the six attributes. Then, students can't hardcode ability scores. The chance of a false positive with two totals being the same and randomly generated should be fairly low, but we can add a comment inline for students to rerun that test if needed. I'd hope you'd only need to rerun that once or twice to get it to pass.

kotp commented 10 months ago

@kotp, should I bump the difficulty? It's at 3, but students will need to figure out how to generate random numbers. A difficulty of 4 would mark it as a medium difficulty exercise.

I think making it medium would be good. We can leave it and get a feeling back via feedback, as well for the students that do the exercise.

I'm also thinking we add a test where we create two characters and compare their total ability score across the six attributes. Then, students can't hardcode ability scores. The chance of a false positive with two totals being the same and randomly generated should be fairly low, but we can add a comment inline for students to rerun that test if needed. I'd hope you'd only need to rerun that once or twice to get it to pass.

We may not need the student to run the tests more than once. If the chances of the same result are fairly low, then we run the tests that threshold, and expect that the numbers do not stay the same total. If they change even once in 4 generations for that test, then the test is probably confirming random. Also, we can use srand() to force the sequence and check in that way as well. We would know what we would expect from the next generation.

BNAndras commented 10 months ago

Ooh, I didn't realize Vim had srand and rand for a while now. That'll help clean up the example.vim file as well.

BNAndras commented 10 months ago

Updated the difficulty and the stub. I'll work on the test suite. The randomness is in the dice roll, not the public-facing ability and modifier functions so I'll need to figure something out or just say good enough.

BNAndras commented 10 months ago

Yeah, the Java track generates a reference D&D character and then up to 1000 more characters, checking each time if at least one of the character's ability scores differ from the reference character's. Therefore, it'll fail quickly if values are hardcoded. That doesn't seem like it'd take a lot of time to run.