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.
Done! Thank you for bringing it up.
This is a great question, I hadn't considered this at all! And as currently implemented, the random tests could generate travels with the same origin and destination, so it is worth considering.
I'm thinking that these represent travels (the wording in the description describes them as such) and therefore if you travel from home to home, you still wander outside for a bit, potentially get rained on, then come back. But this is a bit lawyer-y.
We could also say "no location will be the same as the current location" in the description, and amend the random tests so that it is true.
What do you think?
When the wanderer comes back to a place, he can re-use the umbrellas that he left there before. He left an umbrella at the shop earlier, so he can re-use it now instead of picking up a new one. (Very nice of the shop-keeper to store this guy's umbrellas)
Merged.
Approved, thank you :)
I don't really get how these things work, but it's a bit strange that this one has been rated 6 kyu when the original "A Man and his Umbrellas" is rated 5 kyu? (I do think the original is not as difficult as its rank implies)
I mean, the original already assumed you could leave a potentially infinite pile of umbrellas at work. I think HR would schedule an awkward meeting with you at some point.
I do find it easier to think about it as "at which locations will I need to buy a new umbrella before embarking on the next leg of the trip?" rather than a magically predicted pile of initial umbrellas, but I feel that spells out the solution a bit too much. (It doesn't really address your main concern either way)
Done, thank you!
Done! Found a way to make it look good. Thank you for the feedback!
I gave that a try but the given inputs were too long to be displayed neatly. I'll give it another go.
@Blind4Basics I did read those. Mostly I was missing how to search effectively, which you clued me in via the tag search.
@dfhwze Can you share a link? Does it evaluate the AST, or just build it?
Ah, yes, those are much closer to this than the ones that I could find through the search. I'll point out some differences between the ones in this search and that one, though I am not objecting to this being considered a duplicate. It's my first kata and I have no idea what I'm doing or where the line for something to be a duplicate is.
I'd say that, of those, the three-pass compiler is the closest one, although it steers the solver in quite a specific direction. This is much more open-ended: you can solve this by constructing a parser and an AST, you can solve this by regex-transpiling it into the interpreter's language and calling
eval()
...This isn't an esoteric language, like BrainFuck, RoboScript or lambda calculus. This looks like a language the solver will be familiar with, it's like PHP and Rust had a baby. Understanding the language itself is not part of the challenge, in that it is exactly what you expect it to be. I'm probably missing it again, but even in the "Interpreter" tag, I can't find anything that looks like a bog-standard programming language.
I thought of this kata as a sort of gateway drug to implementing your own programming language. The ones I linked seem to me that they would be more appealing to people who already have an interest in building interpreters.
That sounds like a fun way to spend the afternoon. Thanks!
Somehow I couldn't find any one that scratched this itch :( Could you share a link or two?
Although I'm sure you can solve this kata without it, I think this is complex enough to get you to build an abstract syntax tree, while still being simple enough that you can solve it in a couple of hours. I could not say the same of the vaguely-adjacent katas that I looked at.