r/PowerShell • u/mdowst • Dec 08 '25
Saving Christmas with PowerShell: Building a Reusable Matching Algorithm
This video isn’t just “here’s a script.” It walks step-by-step through the whole evolution of the solution:
- Start with a naive random shuffle
- Add constraints and filtering
- Introduce backtracking when things get messy
- Turn it all into a clean, reusable function
The end result is a robust matching engine you can adapt for scheduling, load balancing, on-call rotations, pairing systems, etc.
Watch: https://youtu.be/4uwQh6Nap5M
Code: https://www.dowst.dev/?p=3971
Feedback and ideas welcome!
13
Upvotes
View all comments
Show parent comment
2
u/mdowst Dec 08 '25
Similar to what I ran into when I started the script too.
Makes me wonder if a more powerful query language like KQL could do it. It would be difficult to do backtracking, but may be a challenge for next Christmas.