Tables in PROS

I am building my own input based rerun from scratch, and would like to implement data tables for management… is this possible in PROS?

Sure, just like you would do otherwise in C. What do you want in your data tables? Will they vary, or are these static values? Most likely you’d want something like

int mat[6][6];

or something like that, varying int based on what you want to hold and varying the number of dimensions of your matrix and the size of each as needed. You can implement them in other ways, too, but (just guessing) you probably want to be able to look up some value you’ve already calculated quickly instead of coding in lots of calculations. For example, maybe you know heights of cones and just want to go from numbers of cones to the angles you’ll need in a reverse four bar. In such a case, your number of cones can just be your index for your matrix.

How I approached my rerun was pretty simple: create a data structure like a struct or a class if you’re using C++ with boolean values representing everything. Then, on each recorded frame, instantiate a new instance of the structure and store that in your array. As for dynamic allocation, I’m not sure if the PROS compiler supports variable array size at runtime (I can check if you want me to), but if that’s not possible, there are ways to manually dynamically allocate an array (but beware, they are somewhat painful)

Yes, the data will vary, is what your describing an array? I am looking at documentation now, seems to be what I am looking for, thanks.

Yes, an array. You can work with as many dimensions as you need, though if things don’t really vary much in all those dimensions, you’re better off with multiple smaller arrays. For example, if your values look like (hope formatting works):

a1a2 b1b2 c1c2
d1d2 e1e2 f1f2
g1g2 h1h2 i1i2

where all those variables are different, then a single array is fine, but if they look like:

a1a2 a1b2 a1c2
b1a2 b1b2 b1c2
c1a2 c1b2 c1c2

then you’re really just looking at six different values instead of nine and the matrix can be costly. Now let’s say you have three dimensions of size 100 each. If you really just have three sets of 100 values, could could store them in three one-dimensional arrays of size 100 for a total of 300 and change worth of memory. But if you store them as a single array, you store a total of 1,000,000 and change worth of memory.

As for the data varying, you can change the values in the array on the fly. Depending on what you’re doing, you may well want to initialize with typical values instead of with all 0s.