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

Fix order of operation bug in rotatePins. #288

Merged
merged 2 commits into from Apr 28, 2021

Commits on Apr 27, 2021

  1. Fix order of operation bug in rotatePins.

    RotatePins uses modulus (%) to avoid over-rotating, but the order of
    operations was wrong:
    
    initialRotation + newRotation % 6
    
    instead of
    
    (initialRotation + newRotation) % 6
    
    In some cases, this could lead to creation of pin index numbers that
    were larger than the number of pins.
    mgjarrett committed Apr 27, 2021
    Configuration menu
    Copy the full SHA
    4baf896 View commit details
    Browse the repository at this point in the history

Commits on Apr 28, 2021

  1. Unit test to catch modulus error during over-rotation.

    If the sum of the current rotation state and the additional rotation
    exceeds 6, the old rotatePins function would over-rotate. The unit
    test was modified to induce this situation, where a 4 x 60 degree
    rotation is applied to a block that has already been rotated 4 x 60. In
    this case, the old rotatePins would calculate a rotNum of 8, which would
    make some pin indexes incorrect.
    mgjarrett committed Apr 28, 2021
    Configuration menu
    Copy the full SHA
    750c667 View commit details
    Browse the repository at this point in the history