5 kyu
Sokoban re-solver : level recovery from solution
31grigr
Loading description...
Game Solvers
Games
Puzzles
Algorithms
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.
Man, I must be looking at this one strangely. I can get the level, but the border around the outside is very difficult to do. Seems like a level 3 kata to me. Must be missing something.
my algorithm restores the level so that you don't have to remove extra walls. but I knew that someone will face this problem. you can make an additional algorithm for filling empty spaces to remove extra walls. or rebuild the logic of your algorithm.
when I created the kata, I suggested rank 4. but those who decided it first changed to level 5. Apparently for some this is a very simple task.
Hi again, your random test generator can very occasionally generate an empty string for the input. Eg. for a 6x6 grid, around 1 in 10 generate an input as an empty string. However, this chance does decrease as you increase the grid size so it's very rare for it to happen in the random tests.
Also, this isn't so much as issue, but could you be able to make the random test generator any faster. It's currently quite slow :P
I agree with you. i saw this error so i run the generate loop multiple times. this is a strange behavior of the random number generator. because of this, the function is slow. I will try to fix it soon...
i fix problem with empy output. also random generate now twice as fast
Looks good. I made a small tweak to the tests, if you don't mind, and approved :)
ok. thank you! this is my first kata :)
No problem. I just noticed that the assertion messages for an incorrect solution are very ugly and hard to see for the user.
I made a fork that should improve the messages: https://www.codewars.com/kumite/631f2a5d8e714f0062cd5497?sel=631f2a5d8e714f0062cd5497, if you wouldn't mind checking and approving it.
Thank you! I thought about it. but I didn't know how to do it right... I also need adjust the coefficients for levels 50 * 50 so that there is less empty space
Are you looking for the initial level setup or the solved level?
you need to find the initial state of the level.
.
This comment has been hidden.
hmm. strange. i will check it. ok i try added more big random levels
i fixe my error. thank you! also i added many big random levels :)
done
There are infinite levels that can satisfy the solution, but the kata never specifies which one should be considered correct. It's only well-defined and unique if you require
And possibly more conditions.
Thanks. I will add it to the description. in fact, the correct approach yields the only solution, as long as you don't add extra details that don't affect the solution in any way.
I added additional restrictions to the description.
You forgot to republish the kata from the editor ;-(
sorry done. please check
Can the solution contain movement (lowercase) against a box?
If yes, should we ignore them?
no. uppercase letter is always movement with box
I added additional restrictions to the description.
done
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
Meaning of such solution is that I can solve your kata without writing a solution, just by inspecting inputs, or by reading failure messages.
It is true that for some types of tasks, for example game simulators and game solvers, it can be difficult to come up with a generator of random test cases. If you'd like some help on this topic, you can find some on
#help-author
channel of Codewars Discord. If you don't want to join Discord, I can drop some ideas here if you prefer.I understood you. I need to think 1-2 days. most likely I can make a simple generator. Thanks
This comment has been hidden.
Thank you. I'll try a slightly different way. Though I think your algorithm will work too.
I made a level generator! it looks like a standalone kata. this is an interesting task
I update test script.
Sokoban
re-solver would also be an interesting kata :Dsoko-solver this is very-very hard task... possible for small levels
after I added random level generation, three solutions became "invalidated". apparently they run again after adding new tests.
I was also interested in a new problem for solving small levels. maybe I'll do it...
i wrote a simple soko-solver. it works with brute-force. unfortunately it is still very slow. if I manage to optimize it, it will probably be a great kata :)