Switch concept and growing array ?
Hello all,
After some coding I got an output of two variables. Usually, the output is as follows:
X: 0, 0, 1, 1, 0
Y: 0, 1, 1, 0, 0
or
X: 0, 1, 1, 0, 0
Y: 0, 0, 1, 1, 0
In short, the important change is when both are 0, 0 and 1, 1 together and either is 0, 1 or 1, 0. At this points the decision are about to be made. For example, when 0, 0 it is either open or close, indeed, if it is open, then either follows the 0, 1 or 1, 0. It never follows the 1, 1. After , 1, 0 or 0, 1 follows 1, 1 and after follows the opposite of what follows before the 1:1. So, if first is 1:0, ( 1:1 ) then it will be 0, 1. It always end or start with the 0, 0.
In short someone could code this as a simple pattern, for example, of few words, like: a(0, 0), b(1, 0), c(1, 1), d(0, 1), and again a(0, 0). So the pattern could easily be deciphered as : a, b, c, d, a or a, d, c, b, a. However, those deciphers repeat, for example, there could be 10 or 2... of a or b, or c, and so on. The number is occurring random, however, in most cases it boils down to 100 for the whole decipher... but nor necessary .
I was thinking to go around this with a several ifs and a growing array aka lists, etc. however, I have found several questions. For example, is the decipher a and c even necessary ? For example, is it not enough to know when the b and d occur to know what occurred in the given decipher. For example, the plan is to make a particular decisions on b and d! But, as you can see there is several of those that occur...
So, thinking to use.
Code:
If(b){ if I am in switch, make a decision and break }. Make the same for the if(d) ...
Would that work, would that be a good idea to go around or is there something else that would be more appropriate to tackle this? Indeed, please comment as well on problems that I do not yet see.
Thank you in advance for any ideas, comments,
best.
PS indeed, the state of variables x,y are changing random, but quickly and the dynamic never stops, its endless.