Difference between revisions of "User:PiRocks"

From Robowiki
Jump to navigation Jump to search
Line 11: Line 11:
 
:So far, the only major glitch I have found is that you can cheat the SecurityManager by achieving a "SafeContext". One easy way to do this is using the following Class...
 
:So far, the only major glitch I have found is that you can cheat the SecurityManager by achieving a "SafeContext". One easy way to do this is using the following Class...
 
<syntaxhighlight>
 
<syntaxhighlight>
double bulletD = 0;
+
package hacker;
int round = scan.round;
+
 
double x = 0, y = 0;
+
/**
while (M.sqr(bulletD) < Point2D.distanceSq(x, y, last.distance, 0)) {
+
* MyClass - a class by (your name here)
bulletD += bulletV;
+
*/
x += scan.relativePoint.getX();
+
public class SecurityLoopHole extends robocode.security.RobocodeSecurityManager
y += scan.relativePoint.getY();
+
{
scan = scan.next;
+
public SecurityLoopHole() { super(null, null,true ,true); }
if (scan == null || scan.round != round)
+
public static void loopHole(SecurityManager z,Thread x) throws Exception {
return null;
+
final robocode.security.RobocodeSecurityManager sm=((robocode.security.RobocodeSecurityManager)z);
}
+
//sm.threadOut(new Boolean(sm.isSafeContext()).toString());
Point2D newEnemyLocation = new Point2D.Double(x, y);
+
System.setSecurityManager(null);
newEnemyLocation = rotate(newEnemyLocation, last.heading);
+
//sm.addSafeThread(x);
newEnemyLocation = new Point2D.Double(newEnemyLocation.getX()
+
//new SecurityLoopHole();
+ r._enemyLocation.getX(), newEnemyLocation.getY()
+
}
+ r._enemyLocation.getY());
 
if (!_fieldRect.contains(newEnemyLocation)) {
 
return null;
 
 
}
 
}
 +
 
</syntaxhighlight>
 
</syntaxhighlight>

Revision as of 02:31, 4 July 2010

PiRocks

I am an experienced Java programmer. As you can guess, I love pi ( and also pie). In RoboRumble, I use the package name "hacker".

I am using "work-around" methods for my robots to make them better as well as find security glitches.

Hacker Robots

Right now my only robot is Destroyer. It is a 1-v-1 and Melee robot. Unfortunately, it was built and tested using Robocode v1.7.2.1 Beta, which has a different SecurityManager. Because of this my work-a-round method to create more threads doesn't work, resulting in auto disqualification. I am trying to fix this, but my next update will probably take a while.

Glitches

1.6.1.4 Glitches

So far, the only major glitch I have found is that you can cheat the SecurityManager by achieving a "SafeContext". One easy way to do this is using the following Class...
package hacker;

/**
 * MyClass - a class by (your name here)
 */
public class SecurityLoopHole extends robocode.security.RobocodeSecurityManager
{
		public SecurityLoopHole() { super(null, null,true ,true); }
	public static void loopHole(SecurityManager z,Thread x) throws Exception {
		final robocode.security.RobocodeSecurityManager sm=((robocode.security.RobocodeSecurityManager)z);
		//sm.threadOut(new Boolean(sm.isSafeContext()).toString());
		System.setSecurityManager(null);
		//sm.addSafeThread(x);
		//new SecurityLoopHole();
	}
}