New ChoiceScript features: implicit control flow, gosub parameters

@Chris_Conley I wrote a version of my maze (Advanced programming - randomized maze) where the map is stored with one long string variable per row (instead of one variable per cell). This way, I was able to create maps of unbounded size.

It’s very easy to read the data with the new setup.
Before (cell based): grid[ x][y] After (row based): grid[ x]#(y+1)

But setting the data is hard, there is no equivalent to:
*set grid[ x ][y] value

To update the string, you have to make a copy, character by character, and change what you need as you scan the original data.


EDIT:

Ok, I bit the bullet, dug a hole through the abstraction layer and started using native Javascript arrays in CS. Oh, my, it’s fast!! It’s like when, back in the days, you would write a small ASM function to speed up some data crunching in C or Python.

Now, in my preprocessor, I have a few new commands *js_array *js_set *js_get that help me do that. Back to the maze, I can have very large maps without a million variables grid_x_y, and it’s several times faster. Note that the result is still valid CS with some *script.

I think I’m now officially off topic. If anybody is interested we can discuss in a new topic.

2 Likes