Saturday, May 12, 2012

Gencon Schedule Solver

Gencon has an absurd number of events taking place over the course of 5 days.  Many of these events are things I'd like to attend, with varying degrees of liking.  Many of the events are run at different times through the weekend, giving me multiple opportunities to attend them.  Some events - such as the True Dungeon events - have over 100 timeslots, others have only a few.  The number of possible schedule combinations are huge.

I could simply pull out the calendar and go over it manually, working out the optimum schedule on my own, but I'm lazy, and when presented with that kind of challenge I prefer to automate it.  So I created a Python script.

This script was in part an excuse to learn how to use some of the url library functions in Python, as it connects on its own to the Gencon community file directory and downloads the latest event calendar automatically.  On extracting the event file it then processes it and attempts to find all events which are the same event run in multiple slots, and combines them into single entry.

There's a fairly simple command-line interface I wrote to search the event list to find the events I wanted, and then assign a priority to each one.  The script then works through all the possible permutations of events, assigns a rating to each one, and then either presents the best possible schedule, or walks the user through the registration process and adjusts the schedule as required to account for events filling up.

It's still crude and buggy, but works for its intended purpose - optimizing your event schedule.

I made the mistake of mentioning this on the Gencon community forums, and immediately received requests for the script.

I have put the script on a pastebin page here:

http://pastebin.com/Rmuf0iJS

Or you can download it as a file from here:

http://www.2shared.com/file/QSKfjxeY/Gencon_schedule_solver_2012.html

To use this, you will need to first install Python 2.7.  Then, either download and extract the zipped file, or create a new file in the Idle python text editor and copy-and-paste the text from pastebin.

Run the script.  The first time it is run, it will create a directory for event calendars.  It will ask you if you want to download the latest schedule.  Obviously, you need to say yes on the first time or it won't have anything to work with.  You can then search for events, create wishlists, and then have it solve for optimal schedules.  Command help is imbedded in the script, just type 'help' at the command line.