7 kyu
Sliding Puzzle Verification
299 of 827abramgornik
Loading description...
Games
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
Ruby 3.0 should be enabled, read this to learn how to do it
Please organize the structure of test fixture as following (although it has been mentioned in the attached link, I'm repeated here again)
Enabled in this fork
This comment has been hidden.
Added new test case for Python and JS.
This comment has been hidden.
The method you're trying to use is not available in the Node version currently supported by CW.
the first link posted below is still valid (see FArekkusu message)
1)it is not valid after anter69 made the change 2)the solution whose link you've replied is valid.
An incorrect solution may pass the tests.
same with this one
Added a test case to all current languages to prevent this:
Ruby translation kumited, including random tests that expect
true
in 20% of the cases. Please check and approveDone. Thanks!
All random tests expect
False
....in python (same type of issue as earlier)
Oops, forgot to port that over.
Fixed.
The function name should be in snake_case in Python.
done
Currently the tests are not putting an acceptable effort to catch bad solutions, because I misread the task and wrote a completely wrong solution and yet it still passes besides the two fixed tests expecting false. There are more things that should appear in the tests.
Interesting. I'm going to change how the random boards are created and then get back to this.
Also, any feedback on better wording for the instructions is welcome.
I think that fixed it. Try again!
;-)
let expects = solvedCheck(testBoard) ? true : false;
No. Just
let expects = solvedCheck(testBoard);
Also, please don't
console.log
things between tests. If you have to log stuff, put it init
headers. But if a test fails, the failure message will already output the expected value, and user can print the input for debugging purposes themselves.Good to know about logging. I didn't know it would output if failed. I had run into a few kata that didn't seem to do that, which was frustrating. I removed the logs.
Oops. Fixed.
Very old ones that use
expect
?I'm assuming that was the case.
Ehm, no. That would be
0
ton²-1
( and the second sample tests has two threes and no two ).Did you mix this up with the minimum value for
N
?The random tests just put random values everywhere, so the "unsolved boards" are actually all invalid.
You're exactly right. Fixed!
In my mind, this is still an unsolved puzzle, but I can certainly change it.
Oh man. It's not that hard to shuffle a board is it?
A description should be correct. If you promise us things, deliver on them, or don't promise! ( Either is acceptable, really. )
Certainly not. Unless I did something incorrectly, its still possible for the random board function to return a solved board, it's just significantly unlikely.
I will refactor it to just scrambling a correct board.
Ok, the randomized tests are now scrambled versions of a solved board.
A sliding puzzle cannot have dimensions
0x0
, and1x1
does not make much sense as well.Good point. I have set the minimum size to
2x2
.All random tests expect
false
.Thanks for all the feedback!
Most of the time, yes. There's very small chance that the random test will be solved, in which case they will expect true. Also, the first set of tests are all random sizes that expect true, so I think that covers the bases.
EVERY time. The only slightly realistic case where that's not true is
[[0, 1], [2, 3]]
- and even then it's just 1 permutation out of 16. Why did you close the issue without fixing anything?I apologize if I'm misunderstanding.
If the issue is that there are no random tests that will expect true, then I think no adjustments are necessary. The first section of tests are random sizes that expect true.
not enough: if the size is random but the expected output is known, that's not "random enough" ;)
Ah ok. I'm not sure how to implement a random test that garauntees at least some results that expect true. If I have to make them completely random, then the chance of that is just going to be very small.
Oh. What if I make it 50/50 that each random test will expect true? Is that what you're looking for?
just do one single batch of random tests, where you randomly choose between two inputs generators. Somehting like:
this way, you get approximately 25% of true answers, but not a fixed amount of them. And in each generator, you use random sizes and all tha t stuff.
Ok, done!
Thanks for your help. If you have time and can offer some clarity on the remaining issue left by
FArekkusu
, I would appreciate it. :)The user can modify the input.
I'm sorry, could you clarify what you mean by that?