tested on Robocode 1.8.3.0 (and also seen on current beta version)
If rule "Hide Enemy Names" is activated there is one case in which one robot can see its own anonymous name and the original name of the enemy robot.
This is when the robot is getting hit by a bullet.
Looking at the source code shows that there is just one single bullet object which will be transfered to both victim and shooter:
in File "BulletPeer.java"
in Function "checkRobotCollision"
Bullet bullet = createBullet(false);
...
otherRobot.addEvent(new HitByBulletEvent(..., bullet));
...
owner.addEvent(new BulletHitEvent(..., bullet));
Nice work. You found an error, and you even found the exact spot in the code where the error occurs. =)
Last edit: Flemming N. Larsen 2014-01-10
I believe that this code
... must be replaced with this code
This has now been fixed for the final version 1.9.0.0.
I had a look at the code changes. Function "checkRobotCollision" seems to be correct now, but I don't understand why function "createBullet" was also modified within this bugfix. I think the old version of "createBullet" was okay. See for example the call of "createBullet" in function "checkWallCollision".
I will definitely have an extra look on this one later (in a couple of days). The bug might have been fixed for this issue, but introduces bugs with the checkRobotCollision() etc. So I need a fullblown test taking all robot events into account regarding robot names. Perhaps the use of createBullet() is not good enough as it must act different in various situations. Perhaps two methods are required or something else. I will loon into this and make sure it is fixed properly before the final version of 1.9.0.0. :-)
I have now reworked the implementation (fix) for this issue. The method createBullet() now takes two parameters: hideOwnerName and hideVictimName that they can be specified individually without any form of indirect dependency. :-)
I have tested all relevant event handler using this robot:
Fixed with version 1.9.0.0 just released.
The problem is still not fixed correctly.
For testing please print also the names within the bullet object, like this:
As I have seen in the source code, the following has to be changed to fix the problem:
in BulletPeer.java, function "checkRobotCollision":
replace
with
and
replace
with
Reopened as the issue does not seem to be fixed 100% after all.
Thanks again for reviewing my work and checking if all had been fixed. Without your validation check, the remaining issue would not have been found so easily. :-)
You are right again. I fixed it, and changed the to use this code again:
That is, now we only need one parameter, as the 2nd parameter introduced with the previous fix was always the opposite of the 1st parameter.
The new test robot looks like this:
The new fix has been commit to GitHub. :-)
Fixed in Robocode 1.9.1.0