I have a problem when doing some exercises. the tests instructions are not displayed anymore. Hard to figure out and change code to solve them. This is not the first exercise I have this kind of behaviour. Have you experienced it ?
The online editor behaves differently, depending on whether the exercise is Concept (on the learning syllabus), or Practice.
- Concept: should have detailed instructions; tests not displayed.
- Practice: brief instructions for context, but the tests are the specification and usually need to be read in detail.
Opinions may differ on whether this is ideal, but it was adopted some years ago as Exercism policy.
Also, the exercises have different aims: Concept exercises are narrowly focused and typically have one preferred solution; Practice exercises are open-ended programming challenges, solvable in many different ways.
As @colinleach said, this is by design. This looks like a concept exercise. The instructions should be clear enough to solve this without needing to look at the tests. If the instructions are not clear enough about something, please let us know what is unclear!
Captainâs Log is a concept exercise, as Iâm sure you know. A brain-to-fingers glitch, I suspect! (I have to warn you, they get a lot more common with age)
Updated
Thanks
What Collin writes here is spot on @mamushiii.
I have an authoring credit in this exercise and if youâre having a hard time âfiguring out what to doâ, my assumption is that youâre used at looking at the tests âand make them passâ. Thatâs now how these exercises are written.
The description and instructions are quite extensive here.
I think that the issue here is not a mistake you made, but a mistake in the test runner which I should fix. The failure is indicating that the function keeps returning NCC-1000 and one of the tests is to check if the value returned is random. I canât see all of the code so I cannot determine why it keeps being 1000.
I assume you wrote:
const randomNumber = 1000 + Math.random() * (9999-1000)
log("randomNumber", randomNumber)
return `NCC-${randomNumber}`
This should absolutely work. If you see repeatedly 1000 or 9999 in your logs, itâs probably because the next test does this:
const min = 0;
const max = 1 - Number.EPSILON * 32;
// prettier-ignore
const restore = loadDie(
min, min, min, min, min, min,
max, max, max, max, max, max,
0.5, 0.5, 0.5, 0.5, 0.5, 0.5
);
loadDie temporarily changes Math.random(), and here you can see it will return the minumum (0) a few times in a row, and then the maximum (almost 1) a few times in a row. Thatâs exactly what youâre seeing in your test run.
You can fix it by running the tests twice (change white space in-between) to clear the random overrides, whilst we fix the tests.
Yeah after testing we also definitely need some infrastructure change to fix this for the browser-test-runner. Working on it ![]()
