Discrepancy between the console result and the expected result.

Good evening, I’m really sorry for the inconvenience, especially since I’m sure it’s a rookie mistake. I have a code, which is executed from a given .txt file which are the following: 5 4.1 11 5 3.2 4.3 0.4 0.0 3.1 And I’m supposed to get this; 3.1 3.2 4.3 3.3 2.3 1.3 0.4 0.3 0.2 0.1 0.0 5 But I don’t get any of this, but I read my code again, and I don’t understand where the problem is. (Also, since there is a console result, I can’t access the debug option).
6 Replies
ACiDCA7
ACiDCA73w ago
i dont see any pattern on first sight how to get from input to expected output what are the rules? where are you stuck?
Jiraknight3
Jiraknight3OP3w ago
Sorry, I did not specify. Basically, in the text where there is data: Line 1: the size of the table. Line 2: The start coordinates of the character. Line 3: The maximum number of moves possible for the character. Line 4: The number of gold coins on the board. Line 5 to 5+(number in line 4): The coordinates of each gold coin. And the incoming text is the set of coordinates at each move of the hero, to grab gold coins. If the character sees a gold coin around him (north, northeast, etc...), he heads for it. If there is 0, it detects the coins that are in the 8 cardinal directions relative to it and advances one step towards the one where there are most of them. And if there are several rooms around him (for example, one to the north, and another to the south), he detects the number of rooms that there are in the North and South, and goes towards the one where there is more. (The order of priority is: North/Northeast/East/Southeast/- South/South West/West/North West). And at the end, the number of pieces collected.
Angius
Angius3w ago
since there is a console result, I can’t access the debug option
What do you mean?
Jiraknight3
Jiraknight3OP3w ago
I found a solution for this. (This is because since there was no "exception error", it did not allow me to use the "arrow" but I found a solution. However, regarding the loops, is there a way to use the debogage for loop N°1, 2... etc.? (to check, for example, the value of x at the end of 3 loops, before the 4th for example? )
Angius
Angius3w ago
Use the right type of breakpoint - Visual Studio (Windows)
Learn about the different types of breakpoints, one of the most important debugging techniques. The article covers breakpoint actions, tracepoints, conditions, and much more.
Jiraknight3
Jiraknight3OP3w ago
Thank you again. 😅 I will see if that help me tonight. Thanks again.

Did you find this page helpful?