You should not generate your own input unless you are testing and debugging your code. Since you place the input generation function within the given function signature, it overrides the inputs given by tests, though your solution is correct.
The numbers in the string must be sorted in ascending order
For example, 34561 => 13456
If there is no 2 in the string, 1 must be the number 7. This is necessary to make an arithmetic progression.
For example, 13456 => 34567 (1 => 7).
If you get an arithmetic progression from the end string, then the string can be designated as STRAIGHT.
If the string has 2 and 1, you just have to check if the numbers in the string make an arithmetic progression
If there is no 1 in the string, you have to do the same thing as 3.
The 1 as a wildcard is already in the STRAIGHT item description, it's not a wildcard for any other result. And 44441 is a POKER, it's already in the description ;)
I solved this kata according to your comment, but in my opinion 12341 and 13451 match the STRAIGHT description.
It would also be nice to add that the wildcard 1 rule only applies to STRAIGHT, because what about the case of 44441? This is not GENERALA 😉
Enabled in this fork
You should not generate your own input unless you are testing and debugging your code. Since you place the input generation function within the given function signature, it overrides the inputs given by tests, though your solution is correct.
kata hint != kata suggestion
I can't lie I let mine run 500 times, the amount of zeros I see are murder. Is that normal?
This comment is hidden because it contains spoiler information about the solution
OP solved it, closing
A little hint concerning "STRAIGHT":
The numbers in the string must be sorted in ascending order
For example, 34561 => 13456
If there is no 2 in the string, 1 must be the number 7. This is necessary to make an arithmetic progression.
For example, 13456 => 34567 (1 => 7).
If you get an arithmetic progression from the end string, then the string can be designated as STRAIGHT.
If the string has 2 and 1, you just have to check if the numbers in the string make an arithmetic progression
If there is no 1 in the string, you have to do the same thing as 3.
Five consecutive numbers, in any order, 1 could be seen as 1 or 7.
Do not really understand a straight condition. Can someone help me?
Clarified how to use the wildcard.
The 1 as a wildcard is already in the STRAIGHT item description, it's not a wildcard for any other result. And 44441 is a POKER, it's already in the description ;)
I solved this kata according to your comment, but in my opinion
12341
and13451
match theSTRAIGHT
description.It would also be nice to add that the wildcard
1
rule only applies toSTRAIGHT
, because what about the case of44441
? This is notGENERALA
😉Damn that straight condition is straight up fcked up.
Because in 13654 the straight is 34561
Loading more items...