(no title)
Adam13531 | 6 years ago
That's a great question, and one with a non-obvious answer! For any potential function in Bot Land, including utility functions like Math.sqrt and Math.pow, I purposely wanted to provide as few as possible until someone expressed a desire for them, that way I could ask about the scenario they were trying to accomplish (as you saw in this thread). From there, I try to figure out if there's an even easier way of supporting their scenario so that everyone (i.e. even Blockly users) could enjoy it.
For example, if we find out that Math.sqrt was needed solely to find distance and that getDistanceTo was sufficient, then I could treat it as an education problem on behalf of Bot Land. In other words, I may want to include more snippets that use "getDistanceTo" or maybe make more tutorial content around that function.
Another philosophy would be to just add whatever functions I can think of and see what users do with it. That would probably have worked too; I'm not saying mine is better, it's just what I was thinking.
ALittleLight|6 years ago
One thing that confused me though, when I was trying to figure out how to square root is that one of your code blocks seems to translate into Math.pow, which made me think that I could use it too.
For the same reason you gave, equality between block-based and text-based programmers, I'd suggest any function that the blocks translate into should be allowed.
If it would help you I can find the specific block I'm referring to latter today.
Adam13531|6 years ago
Oh good! Thanks for following up on that.
> one of your code blocks seems to translate into Math.pow, which made me think that I could use it too.
The way that the blocks work is that they convert into JavaScript under the hood. This means that there's no way to do something through the blocks that you can't do in code (although the converse isn't necessarily true). This means that if there is a block that converts to Math.pow, it's broken, so I'd definitely like to know about that if you find it.
pbhjpbhj|6 years ago
trentlott|6 years ago
Well, the middle ground could be allowing the basic PEMDAS mathematic functions and their inverses, just to allow common manipulations