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.
OP solved the task, closing
You are thinking as of [row][column] and the solution is [column][row]
For this kata, coordinates in the maze are 0-based. First coordinate is horizontal (x), increasing left to right, and the second one is vertical (y) increasing from top to bottom.
Such coordinate system is somewhat "customary" and I believe that's why it's not explained in details, but I've seen remarks in the comments that it's not sufficiently clarified in the description.
You have to be careful when reading the mazes, because in C++, backslashes are escaped what makes them tricky to read. Without escaped characters, mazes look like this:
I marked places where beam exits the maze with
+
, and they are located at(0,1)
for the first maze, and(6,4)
for the second maze.To start with, remove the line
Also, I recommend you convert the C-style string to a C++ string.
This might help refactor the code and simplify it further.
Read this, try Github channels if you're in a hurry.
Thanks for sharing. It's interesting to me cuz I never had that error.
By some quick debugging I found the problem: your
for
loop initializesunsigned int
until it goes negative. But here's the problem withunsigned
- it doesn't go negative :P Once you try to do0 - 1
, it results in4294967295
, which is still>= 0
, and when you try to access a character at that index, you get this error.I hope that's helpful. There are still some logical errors in your code, but this should get you started :>
The error is rare, but at the same time - too generic. It seems to contain some sort of undefined behaviour.
Would you mind posting your code here? (mark it as spoiler)