Skip to content

Conversation

@Khaedra
Copy link
Contributor

@Khaedra Khaedra commented Dec 11, 2025

Updated the Dinubot algorithm to reduce repeat pairings.

Problem

The Dinubot algorithm did not work as intended - static and dynamic arrays served no purpose. They got combined together and shuffled (not following the implementation diagram). There was also no mechanism to check a member's previous pairings to prevent repeats.

Changes

  • Got rid of static/dynamic arrays - replaced with a single array that is shuffled each week
  • added a lastPairings field to the database, which stores a member's last 5 donuts (encrypted ids)
  • Dinubot checks a member's dontPair AND lastPairings array to make sure there are no conflicts before finalizing
  • Fixed bug with optoutcycles - some member's had NaN in the database meaning they never get opted back in. Added a conditional check so this will be fixed next time dinubot runs.
  • Commented out old static and dynamic array logic in case we want to revert/use a different method. Let me know if these should be deleted.

Other Notes

  • The next time dinubot runs, everyone will be initialized with an empty lastPairings array, meaning there is a chance for repeats. However, members shouldn't get paired with someone they have paired with in the last 5 cycles afterwards.
  • Also considered other algos like round robin and weighted randoms but it seemed too complicated for poor liitle Dinubot. Open to discussion.
  • Currently, the pairing function runs a max of 500 times before giving up. It is very unlikely that this will happen even with all the people in dontPair or optedout.
  • Checking the last 5 members is hardcoded, this can be increased/decreased if desired.

@Khaedra Khaedra self-assigned this Dec 11, 2025
Copy link
Contributor

@tdanielles tdanielles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think it lgtm tysm for looking into it -- we can merge and see how it does! you can also just delete the commented out parts in favour of cleanliness, since if we really needed them back we can just look at history anw

@Khaedra Khaedra merged commit 62fa93c into main Dec 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants