Data Structure for block stacks #6
Replies: 2 comments
-
We need to track the screen position of the Start Blocks, Action Blocks, and crumbs somewhere. (But not the positions of any of the other blocks.) I do like this format -- it is reasonable transparent. But it will result in files an order of magnitude larger than the ones we create now. |
Beta Was this translation helpful? Give feedback.
-
The |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
This is similar to
generateStacksTree()
inmusicblocks/js/js-export/generate.js
.Every block is represented by a JSON object. A stack of blocks is a linked list of the said objects. A clamp block creates a nesting, thus adding depth to the data structure. Arguments are a list, each of which can be chained, therefore are like a list of 1-ary tree. Finally, we'd have three global lists of all top-level stacks: start blocks, action blocks, and crumbs (the ones without any start or action); each of the three will contain lists of the data structure discussed prior. Combining these, we have a 4-dimensional recursive, hierarchical data structure.
JSON block object interfaces
This is not exhaustive; more runtime information might be required.
Example
would be equivalent to:
I wrote this by hand so there might be mistakes.
@walterbender
Beta Was this translation helpful? Give feedback.
All reactions