Bruh how am I supposed to debug if I can’t see the conditions or the error messages or the output. I think I’m gonna have to give up on this with 90%.
Don’t you find it odd that your code doesn’t change K’s position even though it is in a different position in the second picture? It’s a big hint for you to debug!
Below is the debug output for your reference. The case numbers refer to the four if/else if blocks in the middle of your code.
F case 2
I case 2
B case 1
C case 2
H case 1
F case 3
I case 3
Z case 1
Y case 1
V case 1
J case 1
M case 2
Q case 2
B case 4
E case 1
S case 1
U case 1
D case 1
L case 1
J case 4
O case 1
R case 1
P case 2
K case 1
N case 2
T case 1
G case 2
C case 3
X case 1
V case 4
N case 3
E case 4
U case 4
Z case 4
H case 4
Q case 3
G case 3
L case 4
A case 1
X case 4
S case 4
D case 4
Y case 4
W case 1
O case 4
T case 4
A case 4
M case 3
R case 4
P case 3
W case 4
Thanks to 5DN1L I’ve fixed the code. The problem was not taking into account when both picture have asteroids on the same position. The fixed code will be available in the same link if anyone wants to torture themselves with some c++ hell. If there was a test case where two asteroids switched positions between picture 1 and 2 it would help a lot of people moving forward (maybe…idk), I don’t know how these puzzles work but it someone can please add that test case.
You really need to change this sentence : " If two or more asteroids have the same final coordinates, output only the closest one."
This is VERY misleading
Hi
could explain how we can find out that in task 07
from all asteroids should remain E, I mean E should overlap HGF ?
what the rule for that?
The statement says:
If two or more asteroids have the same final coordinates, output only the closest one.
And the statement also defines “closest” as follows:
Asteroids travel at different altitudes (with A being the closest and Z the farthest from your observation point)…
I had a problem with rounding. Tried round, roundf, roundl, floor, ceil. But all the same, there were problems with the last task - sometimes one letter comes out, which is incorrect, then another.
What helped in the end, maybe someone will need it.
There is no need to round anything up to the last moment. And discard all coordinates that do not fit in the given field. For example, if it turned out to be -0.5, then we do not show such an asteroid. Because at first my program thought it was zero and gave an error. And only then convert float to int.
OMG it was awful, until i realised that T numbers are important.
Still not easy as it looks but it was kinda fun
This was excellent, thank you for taking the time in making this possible to do!
how does the bounds work in the “Greater delta” the asteroid stops at the edge but in “Out of bounds” test the asteroids disappear from the image
(Assume the photos start at column 1.)
In “Greater delta”, there are 6 columns in each photo, and A moves 1 unit per 1 time unit.
At t = 1, A is at column 1.
At t = 5, A is at column 5.
At t = 6, A is at column 6, so it’s still within the photo.
In “Out of bounds”, there are 10 columns in each photo.
E moves 5 units per 100 time units.
At t = 100, E is at column 1.
At t = 200, E is at column 6.
At t = 300, E is at column 11, so it’s outside the photo.
J also moves 5 units per 100 time units.
At t = 100, J is at column 10.
At t = 200, J is at column 5.
At t = 300, J is at column 0, so it’s outside the photo.
Validator 10 still false for me.
i calc x and y in 3 ways by now.
it is probabily a very expecific situation
In my opinion there is at least one testcase missing.
The listing says that if 2 asteriods fell on the same field on t3, you should choose the “closer” one to 0,0.
So in my implementation i preserved a “If” for that
For c := low(Asteroids) To high(Asteroids) Do Begin
If Asteroids[c].alive Then Begin
px := trunc(Asteroids[c].t3posX);
py := trunc(Asteroids[c].t3posY);
If (Asteroids[c].t3posX >= 0) And (Asteroids[c].t3posY >= 0) And (px < w) And (py < h) Then Begin
If Field2[py][px + 1] <> ‘.’ Then Begin // test if field is already occupied
// This case is described, but does not seem to be tested
End
Else Begin
Field2[py][px + 1] := c;
End;
End;
End;
End;
As you could see, i was to lazy to implement the missing case in the first step and just hit the test button. I passed all tests and all validators → Testcouverage is not 100%
Is there a way where the creater could add more testcases, so that my code will fail, as it at the moment does not fullfill all specifications …
Not
one to 0,0
but choose alphabetically first.