5 kyu
Amoeba: Blind Maze
30kee-reel
Loading description...
Puzzles
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.
Good kata but test design is annoying. Each test case should have its own
it
block, and you could enableallow_raise
to exit test cases early on first failureThe fixed tests and random tests are currently very unhelpful in debugging, they might as well not exist. At least these two things are needed:
You've reached maximum amount of iterations: 20 Here is how maze looked like at start: 52 58 64 || :: 46 || 70 || 94 40 || 76 82 88 34 || || || || ~* 22 16 10 04 Here is how it looks at the end: 52 58 64 || :: 46 || 70 || 94 40 || 76 82 88 34 || || || || ~* 22 16 10 04 You could debug this maze by putting following list in "maze" parameter in test_amoeba_brain(): [[0, 0, 0, 1, 3], [0, 1, 0, 1, 0], [0, 1, 0, 0, 0], [0, 1, 1, 1, 1], [2, 0, 0, 0, 0]]
maze = [ [0, 0, 3], [0, 1, 1], [0, 1, 2] ]
0 - empty, 1, wall, 2 -amoeba, 3 - food
``` More than this - user can copy-paste initial maze structure from postmortem log and try it in sample test.
Added all this in the description of kata.
Needs more random tests, or at least better fixed/random tests: solutions like this sometimes pass the random tests.
This comment has been hidden.
Wow! Because of this even legit but not optimal solutions are invalidated!
'later ;o
Thanks!
Hi,
just actually put the fixed tests in the sample tests. No user will try to debug their code with random parameters in the sample tests, expecially because the user doesn't know what your function helper is doing exactly. So actual fixed test are way more useful.
.
:o
holy... you really need to get your coordinates thing straight and clear:
da hell? XD
I (and I guess anybody else?) would have expected that the surroudning array is actually matching the coordinates around in the maze, but that's not at all what you did.
That's one of the most confusing choice you could do, imo. I'd strongly "suggest" you rework the kata so that the data in surrounding lists are actually matching what is viewed in the maze. Keeping things that way is just transforming your kata in a pain for the user.
edit: I mean that the surrounding thing should be this one below, whatever your coordinate system is:
Yes, I've broken something while fixing other issues :c
I'll unpublish it untill everything neat and clean
Thank you!
Whew! What a nice start of the day :D
Fixed surrounding and direction (for sure). Added in desctiption mentioning of Y axis direction and behaviour when hitting walls. Changed view of debug output, so it's clear when your code is executing.
And again, thank you so much for feedback! 🤩
that part seems now consistent (I still don't like the y axis going up, but at least it's specified, now)
mmmh... Currently trying the sample tests and I get food_smell values that are always 0 on 2 neighboring positions... is that a bug? Or are some other specifications missing? I'd expect 2 different values, since I moved (and according to the logs, I moved toward the food => expecting something like
0.00x
?)Hi,
Looks like a bug, I'm looking into it.
Is it happening on fixed maze or on random one?
Is this consistently so? Perhaps there are two paths to the food of equal length, and you are switching from the end of one path, to the end of another?
it's consistent, on the first fixed sample tests, yes (I didn't run the full test suite so far)
I've fixed it! This problem existed only in fixed maze. Sorry for inconvenience :c
:+1:
it would help if your testing function would raise an error if the user is trying to move on a wall or outside of the maze. Currently, it looks like you just silent the move and keep going. (is that specified, btw??)
Yes, it is specified - amoeba just hits the wall and don't move. You could see it in debug print mode. I'll add it in description - thank you for feedback!
I missed the line, sorry.
Tho, I don't think it's a good idea that your code does nothing "visible" at all in that case. If you don't want to go for the exception thing, at the very least, provide a specific message in your logs.
Hi,
You showed in the description that axis are y/vertical and x/horizontal, but you didn't specify in what direction you chose to use y axis: natural (up) or indexing (down) direction for positive values? (unless I missed it, but I couldn't see the info)
Cheers
apparently, you used indexing direction (I profoundly don't like this setup... Personnal taste...)
Strange, I used indexing direction (at least I show it that way in directions and debug output). I'm looking into it!
what part? Me not liking it? x)
Of course no :D
I also prefer natural indexing. I've checked direction:
With constant direction (-1, 0) amoeba moves like this:
With constant direction (0, -1) amoeba moves like this:
But for surrounding y points down - fixing it.
ok, I got the "strange" part: it seems I mixed up directions somewhere and you actually didn't use indexing direction for positive values... x)
to make things simple:
move = (-1,-1)
=> where is the A going in that case? left+down?edit: crossed messages. Yeah, that's it. => you're using "natural" up direction for positive values of y (which is totally unatural to me in CS context x) ) => just amend the description to make the choice clear
Fixed surrounding orientation -- now it's natural (y is up). Added mentioning of it in description.
I'll close here, but you might need to rework the description about that again, once the issue above is resolved too (I finally got why I mixed up the things before)
Does the "food sense" show distance ignoring walls? Or does it show distance of the shortest path to the food? (I am assuming the first option)
It's "shortest path to the food" I thought to implement first option, but it will make this parameter almost useless (because path to food could be in other direction). Thank you, I'll add it to description.
but they are random
Oh, thank you! Actually maze is fixed - food and amoeba spawn is random. Fixing...
Fixed!