Created
October 20, 2018 13:20
-
-
Save Athanasius/d65c51debf923926376f53f144e00170 to your computer and use it in GitHub Desktop.
ED BGS faction info debounce pseudo-code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for factions: | |
for oldest = 0 ; oldest < sizeof(factionhistory) ; oldest++: | |
old = oldest + 1 | |
next = old + 1 | |
#################################### | |
# Handle wild bounce back and forth | |
# [ A B A ] B A B A B A B | |
# [ A B X ] B A B A B A B | |
# [ A B ] B A B A B A B | |
# [ A B B ] A B A B A B | |
# [ A B X ] A B A B A B | |
# [ A B ] A B A B A B | |
# [ A B A ] B A B A B | |
#### | |
# Should bail on | |
# [ A B C ] D <--- next isn't the same as old or oldest | |
while (factionhistory[next] == factionhistory[oldest] OR | |
factionhistory[next] == factionhistory[old]) | |
# A B A <--- third is old cached value | |
# A B B <--- third is now same as already known new value | |
delete factionhistory[next] | |
next++ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment