Update #15. Virtual machines and revelationsAs you might remember (if you don't, you can read about it
here) last time I began with developing a virtual machine with its own ASM-like language called
NeuroVM. This time is no different, but this time it's way more powerful. Please welcome,
NeuroVM 2.0.
But first, let me slightly introduce you to the game situation I'm using as a example of what I'm going to solve with all the stuff I'm creating right now.
Imaging having a bot with a material scanner that scans the space in front of it. Your task is to move the bot to the wall if the wall is made of some kind of material (let's say, plastic) or simply ignore everything and stay in place if it isn't. Simple enough.
The scheme player needs to design to solve this puzzle must be something like this:
Fuchsia wires (like the one that connects
START w/
SCAN) connect so called "flow" ports.
Flow is the concept that is pretty familiar to those who ever touched Unreal Engine 4's Blueprints. Basically, Flow is the way program will execute during one cycle (execution from
START element to
END element). Flows can be split (welcome to parallel programming hell!), synchronized, merged and branched by
BRANCH blocks. Green wires connect integer ports. Red wires connect boolean ports.
Following the flow on the diagram the algorithm for the scheme is:
1.
START the cycle for bot #1
2. Asking bot #1 to
SCAN the space in front of it
3. Compare
MAT output from
SCAN element (bottom right port) with
CONST 005 (code for plastic) with
EQ element
4. If
true, move bot #1 forward for
DST steps (middle right port of
SCAN) with
FWDN element, then
END the cycle for bot #1
5. If
false,
END the cycle for bot #1
As you can see not all the elements have Flow ports.
EQ and
CONST elements process data in the background once all their input ports receive data.
Now, when you understand (I hope) Flow and scheme basics I can go back to explaining
NeuroVM 2.0.
Key features of
NeuroVM 2.0 are data types, variables, const and dynamic/duck typing. In
NVM 1.0 there was only one data type, integer numbers, so there was no need in duck typing. This time I there are three types of data: integer, boolean and bot handle. The last one acts as Flow exclusive data type and contains a direct pointer to Flow owner, the bot.
Because I have data types I can't just allow the same behaviour as before, so variables have types too now. You can define a variable without type, but it will be set after first assignment and can't be change after that. It was made to add integrity control over types and to protect
NeuroVM from JS dynamic typing hell.
Another feature is direct bot memory access. By using bot handle variables I can get access to bot inner memory directly from element code so I can write and read data from bot. Bot operates as a standalone entity with its own memory and processor.
That's all I wanted to say about
NeuroVM without drowning in boring tech stuff (yes, there are even more details). So you can say this time I'm pretty serious about NeuroIDE.
The next step is scheme emulator. Here I go!
P.S. The title is slightly related to Muse's "Black Holes and Revelations".