Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
I suggest fixing a few sentences in the Instructions for clarity. My suggested versions are below:
-If the player has at least 6 more power than the enemy (including modifiers), the player automatically wins, as the enemy's combat score couldn't possibly exceed the player's.
-If the player has less power than the enemy (including modifiers), the player can only win if the enemy rolls low enough for the player to have a chance. In this instance, the method should return a range equal to the ENEMY’s dice rolls which would give the player a chance to win.
Yes, I mean that it is probably better to say something like 'change that method'.
Sure I need more experience to get such things better )).
it seems the test for
1000
has invalidated a great many solutions. should this test be removed ?OK I have it now. 10 guesses is sufficent to solve any number between 1 and 1000!
Thanks for your help.
yes, there is a more efficient algorithm. you should not be picking numbers randomly.
Wrong. There should be no randomness involved in your algorithm. Otherwise, you're right: you may need more than 10 guesses.
After the first guess, why do you need to pick a random number? Why did you pick 500 initially?
OK,
So I have 10 guesses to figure out a number between 1 and 1000: Lets say the number to be guessed is 345.
Now my first guess is 500 obviously too high, I then refine my guess to pick a random number between 1 and 500.
I continue refining the range of the guess depending on the result of the previous guess. So for example, my second guess is 200 which is too low then my third guess will be between 200 and 500. One can easily use up the 10 guesses without reaching the correct number in 10 guesses. It is not possible to make it more efficent than that!
So my issue is still boils down to what to I do if I don't guess the correct number within 10 guesses?
The name depends on the language.
To me the description is not clear. It says to write method 'get_number()', but there is already method 'getNumber()' (without underscore). Cycle in it runs for 1000 times when there are only 10 attempts. Those things are confusing.
I have a solution to this kata, it works fine when I guess the number within 10 guesses. However I can't figure out what I'm supposed to do if I fail to find the number within 10 guesses.
For example this is the message I get: "you guessed 604, but the number was 600: expected 604 to equal 600"
Any suggestions as to what I can do to finish this kata will e gratefully accepted.
fixed
JS: RangeError: You cannot make more than 10 guesses ! The number to guess was 1001
C translation (author inactive)
the design of the kata is nonsensical in JS, we are asked to guess a number from the very instance where this number is stored, you literally only have to return the number property to pass the tests !
the reference solution also does not work for
1000
proposed fork with Node 14, information hiding, backward compatibility, edge cases, random tests
please make a python version... quite excited to try my hand on this!
Loading more items...