Jiraknight3
Discrepancy between the console result and the expected result.
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? )
7 replies
Discrepancy between the console result and the expected result.
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.
7 replies
Unhandled exception. System.IndexOutOfRangeException: Index was outside the bounds of the array.
Line 81'''if (XArrayCoordoninateCoins[numberGoldPiece] == x YArrayCoordoninateCoins[numberGoldPiece] == y)
{
Console.WriteLine("That exists.");
}
else
{
}'''
Yes ; but right there with'''XArrayCoordoninateCoins[numberGoldPiece] == x YArrayCoordoninateCoins[numberGoldPiece] == y)'''
I try to check each value contained in both array. Isn’t that how we do it?
33 replies