Hi,
what is your opinion to this suggestion:
I could rewriting your code keeping the logic as it is now but
I take your variable-names as a base but modifiy them all to be really self-explaining like in the examples above.
I add constants that have self-explaining names too like in the example above
and replace the hardcpded numbers like "1" or "0" with these constants.
This would make your code much more readable and it comes closer to "normal language"
what do you think? Would you like me to do that?
if yes this could be a base for more support in transforming your code into using a switch-case state-machine
best regards Stefan