I have implemented an interpreter for a custom "bytecode". The interpreter is just over 700 bytes of bytecode so it fits in a microbot. I think java put a limit of 64Kb on strings so thats the limit of how advanced the bot can be. Well, the interpreted language puts a lot of constraints on what can be done.
The custom bytecode looks a bit like [funge]. It is hard to write, harder to read and probably impossible to debug, so don't expect any killer bot comming out of this. =)
Size optimizations for the interpreter are very welcome.
Have anybody tried something like this before? -- Strider
The code is here now! -- Strider
Actually, I'm looking at a similar, smaller system for my next bot. What I was making, though, was a command queue, which would include commands like ahead(x), fire(y), turnRight(z). The idea was to set up an exact future for my bot. --Goofy
I just had the same idea and implemented an interpreter robot which fits into a MicroBot and can do theoretical everything a MegaBot can. I saw how you access the setters and getters - very flexible and small. We should take a look at the java API, perhaps java byte code can be executed from an byte array ( converted from String at runtime ) without SecurityException? If not, perhaps classes can be instantiated from a string ( especially Math and Streams ) --Sin Varg
My first thought would be the reflection API... --Alphax
You need a class loader to load from a byte array, and the security manager won't let you make your own class loader. So you have to interpret your byte or string manually. --David Alves
Uh oh. -- Simonton
You should get rid of the quotation marks. -- Zian
Not in my time here. -- Simonton