The programs look suspiciously alike. Mine worries about who your spouse is as well. And it worries about who you had last year and avoids duplicating your match up two years in a row. It also relies on an XML configuration file (savable year to year). And it mails a notice to every participant (via Outlook, I was lazy). But it doesn't have nearly as much code as ZachCox's - I think 20% of my code is loading the XML and 20% is testing code, and 30% is the automated VB form code. The primary code file is all of 19K. The compiled app is 32K. The most important bit of code in my opinion is the following...
Do Until indivSecond <> indivFirst
If iTrys > UBound(people2(), 2) + 50 Then . . .
Yep, bit of hardcoding. Basically, if it gets through the whole list, and is on the last match, and it just can't make it work after 50 tries plus the size of the list, it scraps everything and starts over from scratch. So it can run for a very long time if it has to start over repeatedly, or you set it up to fail by making someone the spouse of everyone. But in thirteen years of running it, sometimes repeatedly for testing purposes, it's never taken more than a few minutes to run my whole family plus any guest family attending Christmas that year. In this case, brute force of the logic works like a charm.
That said, every year I ponder rewriting it in C# and perhaps making it so people can log in and create lists. And every year I realize it's the holidays and I'd rather go Christmas shopping, visit Christmas displays, and do anything else. Just more proof that I'm a very utilitarian coder who uses code solely to solve his own problems.
I have one of these as well. Written in Groovy.
ReplyDeleteIf it's written in Groovy, then mine must be older.
ReplyDelete