I had a crazy idea I just had to try to implement. I got it when working on my nanobots. It's a way to cheat codesize.jar and fit more advanced code into the bot than would otherwise be possible.
Because only bytecode counts and strings in the class file are free I though that it must be possible to put the actual code into strings and then execute them using an interpreter.
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. Here are some of the features:
* Fixed size stack of doubles
* Fixed size static heap of doubles
* Basic stack operations: push, dup, drop, swap, pick, etc.
* Aritmethic operations: subtraction, multiplication and less-than-zero
* Heap operations: load and store.
* Branching: conditional and unconditional jump, subroutine call and return.
* Java interface: Ability to call getters and setters on the robot and on the event.
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. =)
When I have cleaned up the code a bit I'll post it if someone is interested.
Have anybody tried something like this before?
| Interpreter | MicroBot | Executes code stored in strings|
Way cool that interpreter of yours. When will you release it? I'd like to try build a bot using it. Since I used to code in PostScript? some years ago I might have a head start with it. -- PEZ
|Mer||NanoBot||StatisticalTargeting / GuessFactorTargeting|
|Interpreter||MicroBot||Executes code stored in strings|
Great! Welcome to the wiki :-) --Vic
Thanks! -- Strider
My 60Gb disk crashed last week. Luckely my cvs-repository was on the other disk so I lost none of my programming projects. Now I have a new 200Gb disk and have reinstalled most of the programs I use. To test my setup of RoboRumble I have released a new version of Festis with new targeting. I'm also going to make the source code of both my bot available on the wiki (extra backup in case I suffer another crash). -- Strider