Skip to content

Instantly share code, notes, and snippets.

@Athanasius
Created October 20, 2018 13:20
Show Gist options
  • Save Athanasius/d65c51debf923926376f53f144e00170 to your computer and use it in GitHub Desktop.
Save Athanasius/d65c51debf923926376f53f144e00170 to your computer and use it in GitHub Desktop.
ED BGS faction info debounce pseudo-code
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