From Robowiki
Revision as of 15:10, 28 May 2009 by Rednaxela (talk | contribs) (reply)
Jump to navigation Jump to search

Just a quick page create to let everyone know I still peruse Robocode on occasion. I'm happy to see DustBunny and Infinity doing their things, and Moebius getting stomped :)

My Bots:

Uh oh, I think I just figured out how to completely cheat the codesize thing. I could probably fit all of Toorkild's code into a nanobot. How? Running Java Byte code from a static buffer. Take any robot's byte code and drop it statically into an array/string/whatever. Array values do not count towards size. Write a routine that jumps the code pointer into the array. You are now running a nearly infinite amount of code without a major size hit. I could probably write a bot like this in an evening if I really wanted to cheat and win this badly. Thoughts? --Miked0801 01:02, 28 May 2009 (UTC)

Oy! Not sure how we'd deal with that. I wonder if Robocode's classloaders could prevent this from happening? Or the code size utility produce some kind of "N/A" code size for classes that do this? --Voidious 02:56, 28 May 2009 (UTC)
I'm fairly sure the Robocode security manager wouldn't allow this, I once tried using Java Reflection and the security manager disabled my bot immediately. However, if it is possible, I think we should either 1) modify the Codesize util so it looks for bytecode in strings as well or 2) fix the security manager so that it isn't possible to jump the code pointer into a static buffer. But why don't you try it and see if it works =) --Skilgannon 09:19, 28 May 2009 (UTC)
Er, I'm 90% sure that jumping the code pointer into a string or array, is completely impossible in java bytecode in the first place. I'm pretty sure that program memory and data memory are considered comletely seperate in the VM... So all this to do with the classloaders/security managers/codesize util is unnecessaary... --Rednaxela 12:45, 28 May 2009 (UTC)
I don't think this is impossible with either javac or Jikes, but how about Jasmin you are working on, Rednaxela? I'm quite sure we can do that in assembly, but not sure with Java assembly. » Nat | Talk » 13:02, 28 May 2009 (UTC)
In machine code for x86 or ARM or most other physical architectures, that is possible, but java bytecode follows a different model. In most physical architectures, "program memory" and "data memory" are the same thing, so one can use the same memory for both purporses. The Java VM follows a different architecture pattern, where "program membory" and "data memory" are seperate and no bytecode instruction has a parameter that can refer to either, only one. (By the way, I'm pretty sure you meant to say "I think this is impossible" or "I don't think this is possible". Only need one negative :)) --Rednaxela 13:10, 28 May 2009 (UTC)