3 ms·
contestants are required to turn in their source, rather than compiled code If there's nothing about the language in which the source must be written in but on
by userbinator 12y ago
contestants are required to turn in their source, rather than compiled code
If there's nothing about the language in which the source must be written in but only that it compiles to JVM bytecode that meets the requirements, I'd be very tempted to write most or almost all of it in bytecode... java.lang.ClassLoader is allowed and it provides some useful methods for that purpose. ;-)
At each block’s exit, a checkpoint is injected with the block’s total cost. During live execution, these checkpoints increment the AI’s internal total bytecode counter. If at any checkpoint the running tally exceeds GameConstants.BYTECODE_LIMIT, the AI’s execution is halted and execution of the next robot’s AI begins.
That sounds to me like it might be possible to squeeze in some more extra instructions at the end.
- marktangotango 12y agoOne might imagine this notion of limiting computational budget of arbitrary code would have applications beyond this particualar application.
- jdmichal 12y agoMy immediate thought was that branchless coding could have a big effect if used right. But those functions usually use more operations to achieve the same effect, so the tradeoff would probably not be worth it.
- icefox 12y agoI was excited to give a shot at Battlecode until I heard about the broken solution to limit resources. >In order to hard limit each team’s total computation, yet guarantee equal computation resources to each team, each team is given a bytecode limit, and their code is instrumented and allowed to run only up to that limit before it is halted. They want to give each team equal cpu time, but when you have a bytecode that has instructions like invokevirtual and multianewarray the execution time isn't' exactly similar. And then there is the story about how in 2007 to make things easier the engine counted the bytecodes of various standard library methods as a predetermined fixed number no matter what happened. So of course someone put A* inside string.matches with a regular expression. (http://realgl.blogspot.com/2013/08/battlecode.html http://realgl.blogspot.com/2013/08/battlecode.html). Sadly whenever I hear about Battlecode I hear stories about how people abused and broke the bytecode limitation to get more cpu resources than everyone else not about how they solved the problem straight up better than everyone else.
- userbinator 12y agoI hear stories about how people abused and broke the bytecode limitation to get more cpu resources than everyone else not about how they solved the problem straight up better than everyone else. Isn't the whole idea behind the "hacker" movement to exploit the boundaries of the rules?
- icefox 12y agoIt all depends. If you are trying to learn more about vm's and bytecode then this was a success. If you were trying to learn how to make a good ai that uses few resources then you might have failed. The challenge seem to be about the latter.