Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a StateMachine #11

Open
net-man opened this issue Oct 15, 2019 · 1 comment
Open

Add a StateMachine #11

net-man opened this issue Oct 15, 2019 · 1 comment
Labels
enhancement New feature or request

Comments

@net-man
Copy link
Owner

net-man commented Oct 15, 2019

Add a StateMachine that keeps track of an array of States and how each is connected to one another.

@net-man net-man added the enhancement New feature or request label Oct 15, 2019
@net-man
Copy link
Owner Author

net-man commented Oct 15, 2019

One solution I think could work is having an array of an int array. ex:

int[][] states = new int[][] { new int[] { 1 }, new int[] { 2 }, new int[] { 3 }, new int[] { 4, 5 } };

This array can be visualized as such:

[ 0 ]  [ 1 ]  [ 2 ]  [ 3 ]  [ 4 ]  [ 5 ]
  1      2      3      4,
                       5

[ 0 ] -> [ 1 ] -> [ 2 ] -> [ 3 ] -> [ 4 ]
                             |----> [ 5 ]

0, 1, and 2 are states with only one output path.
3 however, is a state with at least two output paths this could be explained as an if condition on the state. ex:

state3:
if (condition) {
  goto(state4);
}
else {
  goto(state5);
}

@net-man net-man added this to the FRC Build Season Starts milestone Nov 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant