I found an unfinished blog post from Halloween of 2017. Given the state of the world, it might be worth revisiting.
Several years ago I had this idea for a game, where people would make virtual robots from snapped together components, and then program the robots in a language of my (poor) design. I’ve actually discussed it a few times on my blog.
I wanted to write a typechecker for the language, or at least something better for error handling, but I didn’t. It looks like three years ago I started to, but I never finished anything substantial. That hasn’t changed.
Instead I am really just throwing this out there once again - with the possibility that yet another FIRST Robotics competition season is cancelled, I think the time is now to come up with some kind of robotics related competition that can be done poorly virtually.
I’ve only added one feature to the language - the ability to modify variables
at more local scopes than global. For instance, the
set built-in function.
set behaves very similarly to
def, which defines one or more variables
in global scope.
set, on the other hand, re-defines variables in the
closest scope it can. This means it is now possible to have a closure
change one of its captured variables, meaning it is now possible to
pretend to have mutable objects through closures. This is pretty cool,
and it only took a minute or so of work.
Additionally, I added dot notation for closures, so you can say
to get the value of the variable x captured by closure obj. This was
done in a hacky and bad way, but it does work as long as there is only
one level of indirection. Finally, I added another def command, ldef,
which is like set or def, but it adds a variable to the most local scope.
This is useful for closures having their own state that is separate
from their creating function.
Going forward, I’d like to add more sensors and actuators. I wonder if some kind of fake electrical subsystem is worth adding. The game does use a 2D physics engine, so perhaps a weight limit could be added, and then there could be different motors, giving more mechanically inclined people something to do. A 3D game would probably be better for this stuff, but that’s hard considering the game being in-browser was a major goal of mine (lots of people use Chromebooks or tablets).