teaching machines

Rator Vaders: Week 3

July 6, 2016 by . Filed under public, ratorvaders.

This week I added strings, chars, and function and method calls to Rator Vaders. Now max("abc".indexOf('c'), ("a" + "b").length()) can attack Earth! I also added a weighting system to the random expression generator to make it easy to progressively generate more complex expressions as the player advances in the game. Initially, only the arithmetic operators and simple integers will be generated. After the player proves herself, we’ll throw in some equality operators. Then some numeric functions. Then some relational operators. Then some logical operators. Then some string methods. And so on. One big risk that looms over me is how to avoid or handle expressions that exceed the screen dimensions. The way Unity works, I can’t determine the size of the text until the frame after which it first appears. I could resort to just using sprites for every letter, but this would add immense pain to style and size tweaks. Remaining on my near-term TODO list is handling divide by 0, incorporating variables, and generating parameters appropriate to their context (for example, charAt should usually accept an index that’s in range).