In our post Use The Trick or Treat Test Tonight To Find Good Urban Design, Brent Toderian discussed urban design and trick or treating in terms of generalities; Paul Knight actually does the math and gives you the formulae; he's the Nate Silver of trick or treating.
Here is the formula for Candy Score:
Candy lovers know that all you need is a costume and a bucket to satisfy your sweet tooth, but in order to maximize a Halloween outing one must focus on the numbers including route efficiency, candy distributors per block (typically dwelling units), and “candy density” (candy pieces per acre). These metrics will not only save you energy, they will also help maximize your time. As any ghoul or goblin knows, time is candy.
Potential Candy Score (Candy Pieces) = Target Neighborhood (Acres) x Houses-Per-Acre x Families-Per-House (accounting for duplexes, etc) x % Candy-Giving-Families x Candy-Pieces-Per-Family
Really, Walkscore should do a candy mashup. Read it all in Maximize Your Halloween with New Urbanism