Therefore, I was able to learn both something new and useful because I was able to get the pathing code working as it did before, but this time by using stack arrays and without blocking other code. I would post the code onto here, but it would be extremely long because it involves a lot of nested functions in order to accommodate all 12 paths that are possible on the track. However, the code works by creating a stack array based on the path assigned to the pod car only if the stack array is empty and a path is given. Then the pod car would switch (or not switch) based on the values in the stack array (0's and 1's) and pop off the end value of the stack array every time the pod car detects a magnet.
Now that we finally have a method of pathing without blocking all other code, we are ready to integrate all our functions together. Hopefully, there will be little to no issues during integration even though it is very unlikely.
No comments:
Post a Comment